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

2009-07-07 Thread Bulat Ziganshin
Hello John, Tuesday, July 7, 2009, 5:48:10 AM, you wrote: you mean that on windows gcc, msvc and all other C compilers use the same ABI for passing and packing structs? Yes. If you think about it, otherwise it would be impossible to interface with system provided shared libraries (like

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

2009-07-01 Thread Duncan Coutts
On Tue, 2009-06-30 at 18:59 -0700, John Meacham wrote: On Tue, Jun 30, 2009 at 01:18:32AM +0100, Duncan Coutts wrote: On IA32 structs/unions passed as parameters go by value on the stack. For structs/unions as function results, they are stored into a caller-allocated area on the stack,

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

2009-06-30 Thread John Meacham
On Tue, Jun 30, 2009 at 01:18:32AM +0100, Duncan Coutts wrote: On IA32 structs/unions passed as parameters go by value on the stack. For structs/unions as function results, they are stored into a caller-allocated area on the stack, pointed to by a hidden first arg. It's different on each

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

2009-06-29 Thread Bulat Ziganshin
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

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

2009-06-29 Thread Duncan Coutts
On Tue, 2009-06-30 at 00:45 +0400, Bulat Ziganshin wrote: 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