[Mono-list] float p/invoke
andreas.faerber at web.de
Sun Nov 12 17:00:25 EST 2006
Am 09.11.2006 um 22:58 schrieb Robert Jordan:
>> I'm facing a weird marshalling issue...
>> The Objective-C runtime on OS X exposes a method:
>> id objc_msgSend(id, SEL, ...); // with id and SEL pointers
>> I marshal it as IntPtr objc_msgSend(IntPtr, IntPtr, ...) using an SRE
>> p/invoke method factory.
>> This has worked fine so far, but now I noticed some marshalling
>> problems. The method's semantic return value is not always a pointer
>> but is apparently also used for int, unsigned int - which works fine
>> through IntPtr casting, but not for float. To my understanding float
>> is single-precision floating point number, thus 32 bits or 4 bytes
>> wide and identical to IntPtr.Size in a 32-bit environment.
> Floating point results are not returned the same way
> as scalar results. For example, the x86 ABI returns
> scalars in the EAX register, while floats are returned
> in a FPU register => it's impossible to marshal them using
> an IntPtr result type.
Thanks. Sorry, I was thinking of a stack like on m68k, not registers.
More information about the Mono-list