[Mono-dev] Marshalling: Bug in StructLayout?

Prakash Punnoor prakash at punnoor.de
Sat Aug 18 10:20:34 EDT 2007


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.

To reproduce: I am on x86_64 Linux (gentoo) using ffmpeg-0.4.9_p20070616-r1 
and tao bindings (http://www.taoframework.com/) from svn. Unfortunately the 
binding are not really matching with the ffmpeg version I have, so I started 
duplicating/correcting the structs, as you can see in the source files.

Nevertheless I stumbled across above behaviour.

I compiled the cs file using 
gmcs ff.cs /lib:/usr/lib64/mono/tao /r:Tao.FFmpeg /out:ff.exe

Just copy an avi file to the folder with ff.exe, rename the avi to "cold.avi" 
and try it out. Instead of the width the height gets printed out, which 
indicates that off by 4 bytes problem. If I set the EXPLICIT define, I get 
correct output

I compiled mono using gcc 4.2.1, might that be a problem?

(°=                 =°)
//\ Prakash Punnoor /\\
V_/                 \_V
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ff.cs
Type: text/x-c++src
Size: 4051 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070818/eb97d510/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070818/eb97d510/attachment-0001.bin 

More information about the Mono-devel-list mailing list