[Mono-dev] Marshalling (Segmentation fault)

Robert Jordan robertj at gmx.net
Thu Oct 11 08:15:22 EDT 2007


russell.kay at realtimeworlds.com wrote:
> The C# version of this Structure would be best expressed as
> 
> [StructLayout(LayoutKind.Explicit)]
> unsafe struct FrameGrab
> {
> 	[FieldOffset(0)]
> 	public int bufferlength;
> 	[FieldOffset(4)]
> 	Public fixed IntPtr buffer[1000]
> }

This is usually bad portability-wise. LayoutKind.Sequential with
the system's ABI default packing should be used instead, unless
the struct really has a specific layout.

Robert




More information about the Mono-devel-list mailing list