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

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Jun 29 16:45:28 EDT 2009

Hello Duncan,

Tuesday, June 30, 2009, 12:03:15 AM, you wrote:

> struct ex {
>      int x;
>      int y;
>      int z;
> };

> ex example_functions (ex p)

afaik, there is C ABI, that defines how to pass and return parameters
of simple types, it's common for all compilers supporting so-called
"cdecl" on any architecture (x86, x86-64, ppc, so on). C ABI doesn't
define how to pass structures, so we can't generate universal
assembler code for this example - it depends on what compiler we want
to interact to

moreover, even for pointers-to-structures, there is no definitive
layout due to packing problem

OTOH, we could try to use gcc agreements

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list