[Mono-list] passing and returning structs in native calls

Edd Barrett vext01 at gmail.com
Mon Jan 10 08:07:29 EST 2011


Hi,

On Fri, Jan 07, 2011 at 04:55:22PM +0100, Robert Jordan wrote:
> 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
> portability.

I have my bindings working now, but this is interesting...

After some consideration, I see that C compilers have to do magic in order to
make it appear as though functions are returning structs bigger than the return
register size.

What confuses me however, is that whatever transformation tha occurs
here *must* be standardised (atleast on a single compiler), as the very
same transformation needs to be understood by the runtime linker when
setting up the execution image of binaries using shared objects.

Is this "understanding" of the ABI just not implemented in mono, or is there a
further complication. I notice the same issue in python.

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk


More information about the Mono-list mailing list