[Mono-dev] Marshalling: Bug in StructLayout?
prakash at punnoor.de
Sat Aug 18 10:50:24 EDT 2007
Am Samstag 18 August 2007 schrieb Rolf Bjarne Kvinge:
> > -----Original Message-----
> > From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> > bounces at lists.ximian.com] On Behalf Of Prakash Punnoor
> > Sent: sábado, 18 de agosto de 2007 16:21
> > To: mono-devel-list at lists.ximian.com
> > Subject: [Mono-dev] Marshalling: Bug in StructLayout?
> > Hi,
> > I am not sure whether I am making something wrong or mono has a bug.
> > Please see attached program. If declare the AVRational struct with
> > explicit offsets, it works, otherwise the width member (and following)
> > in AVFormatContext are off by 4 bytes.
> Structs may be padded according to the platform you're running on, so it's
> not a bug.
> MSDN says about SequentialLayout: The members of the object are laid out
> sequentially, in the order in which they appear when exported to unmanaged
> memory. The members are laid out according to the packing specified in
> StructLayoutAttribute.Pack, and can be noncontiguous.
> You have to use explicit layout (or StructLayoutAttribute.Pack) to get the
> correct structure on all platforms.
Thanks for the quick response. Unfortunately I expected
to work, but it doesn't, neither. So it seems I really have to explicitly
align everything? *sigh*
//\ Prakash Punnoor /\\
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070818/9c04c0c9/attachment.bin
More information about the Mono-devel-list