[Mono-list] passing and returning structs in native calls
robertj at gmx.net
Fri Jan 7 10:55:22 EST 2011
On 07.01.2011 16:19, Edd Barrett wrote:
> Why is this? Myself and a colleague have spent a number of hours trying
> to work this out.
Because returning structs by value from functions is problematic
in general. Try to stay away from such signatures if you want
> Changing the function to return the integer within the struct instead of
> the struct itself works as expected, but that is not really what I want.
> I am using an amd64 machine on OpenBSD (which uses fastcall by default,
> is this the issue? I know microsoft mono does not support fastcall.
> Having said that, openbsd has working packages of gtk#, for example.)
GTK avoids returning structs by value.
> Or perhaps this is a mono bug... I'm completely stuck at this point.
Maybe. IIRC, Mono on amd64 doesn't handle correctly structs of
sizeof < 8 as return values.
More information about the Mono-list