[Mono-dev] Linear layout struct containing IntPtr is not marshaled properly

Pavel Šavara pavel.savara at gmail.com
Sun Mar 21 11:21:23 EDT 2010


> You're pretending that the p/invoke is returning a struct:
> but the p/invoke is actually returning a pointer:

> But this only working by accident. Any other ABI that
> doesn't have these struct semantics will not work.

It seems like you are right
http://www.programmersheaven.com/2/Calling-conventions

cdecl/gcc : "All structures and classes are returned in memory
regardless of complexity or size."

So my assumption that structures passed by value are really passed by
value was incorrect!

I closed bug 590014.

It would be useful to mention this behavior in Structure marshaling here
http://www.mono-project.com/Interop_with_Native_Libraries#Class_and_Structure_Marshaling

Thanks for you help
Pavel


More information about the Mono-devel-list mailing list