[Mono-list] Marshaling on Mac
robertj at gmx.net
Mon Aug 25 10:26:46 EDT 2008
> *** Question number 1 : Why do I have to explicitly tell it the struct
> layout, it is pretty obviouse here isn't it ? shouldn't this just be simple
> blitting ? is it because of the fact that this is a struct being used under
> another struct ?
No. It's because UTCDateTime is defined within a `#pragma options
align=mac68k' section in its C header file.
This means it doesn't have a default structure packing. IIRC,
"mac68k" packing means a packing of one, so your managed UTCDateTime
struct must be declared with:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
> My questions are :
> 1. Is it a mono issue that the simple struct-withing-struct scenario isn't
> blitted well ? or am I missing something while working against the Carbon
> libraries in terms of encoding/memory layout...
> 3. Is it a mono issue that I have to either do fancy tricks and give up on
> auto-marshaling of the array in the middle, or set the Entire FSVolumeInfo
> struct layout to Explicit ?
Check and adjust the packing of all other structs you're planning to
use. It should fly then.
More information about the Mono-list