[Haskell-cafe] Re: Can my type be allowed as return type in FFI?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Dec 11 10:33:17 EST 2008

On 2008 Dec 11, at 10:28, Mauricio wrote:
>>> and obviously a C compiler is entitled to return a small struct
>> in registers if it feels like it.
> If a compiler is compiling code that calls a library, how is it
> supposed to know if a return pointer is been passed as a register
> or by using a pointer? The compiler may not have access to the

The rules are specified as part of an ABI.  There is a default ABI for  
a platform, or you can use a special one (document it).  IIRC some  
CPUs allow information about passed/returned values to be passed in a  
flag word.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list