[Issue 9931] Bus error interfacing with C function returning structs with floats
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 16 23:38:55 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9931
--- Comment #8 from Jacob Carlborg <doob at me.com> 2013-04-16 23:38:53 PDT ---
(In reply to comment #7)
> Seems like OSX deviates from the SysV IA-32 ABI for memory struct returns.
> The callee does NOT return the hidden pointer in EAX.
> Instead the caller has to use the value passed as argument.
I don't know if this is what you're but the the ABI documentation says:
"When a function returns a structure or union larger than 8 bytes, the caller
passes a pointer to appropriate storage as the first argument to the function."
And:
"The called function returns structures according to their aligned size.
* Structures 1 or 2 bytes in size are placed in EAX.
* Structures 4 or 8 bytes in size are placed in: EAX and EDX.
* Structures of other sizes are placed at the address supplied by the caller.
For example, the C++ language occasionally forces the compiler to return a
value in memory when it would normally be returned in registers. See “Passing
Arguments” for more information."
http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/130-IA-32_Function_Calling_Conventions/IA32.html#//apple_ref/doc/uid/TP40002492-SW4
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list