« Return to Thread: Could FFI support pass-by-value of structs?

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

by Bulat Ziganshin-2 :: Rate this Message:

Reply to Author | View in Thread

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@...

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

 « Return to Thread: Could FFI support pass-by-value of structs?