[Mono-dev] Marshalling: Bug in StructLayout?

Jonathan Pryor jonpryor at vt.edu
Sat Aug 18 15:31:44 EDT 2007

On Sat, 2007-08-18 at 16:20 +0200, Prakash Punnoor wrote:
> 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.

Out of curiosity, what happens if you remove all attributes, e.g.:

                public struct AVRational
                        public int num;
                        public int den;

(The [StructLayout] shouldn't be necessary, as sequential layout is the
default for structs, and the [MarshalAs] shouldn't be necessary, as, I4
is the default for `int' as well.)

 - Jon

More information about the Mono-devel-list mailing list