[Haskell-cafe] Re: Could FFI support pass-by-value of structs?

John Meacham john at repetae.net
Wed Jun 24 21:48:46 EDT 2009


On Wed, Jun 24, 2009 at 10:23:29AM -0300, Maurí­cio wrote:
> However, isn't just knowing the size and alignment enough to
> write a generic struct handler that, by using the appropriate
> calling convention, is going to work with any struct? If not,
> I agree with you it's really not worth it (as we can use pointers
> as Felipe sugested.

No, unfortunately it is not. Depending on the actual data types inside
the struct, values may be passed in registers, the stack, or split
between the two. for instance, the floating point values in a given
struct may be passed in SSE registers on x86-64, while the integral
parts are passed in normal registers. 

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/


More information about the Haskell-Cafe mailing list