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

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Jul 1 18:57:29 EDT 2009

On Thu, 2009-07-02 at 01:26 +0400, Bulat Ziganshin wrote:
> Hello Duncan,
> Tuesday, June 30, 2009, 4:18:32 AM, you wrote:
> > Actually passing structs and unions as arguments or function results is
> > specified by the C ABI. See for example the IA32 ABI:
> > http://www.caldera.com/developers/devspecs/abi386-4.pdf
> > linked from the LSB:
> > http://refspecs.linux-foundation.org/LSB_3.1.0/LSB-Core-IA32/LSB-Core-IA32/normativerefs.html
> sorry, it's "System V ABI, IA32 Supplement"
> so situation is still the same - afaik, there is no common ABI for all
> C compilers on x86 platform that describes structures passing and alignment

You don't need it to be the same between Windows and Unix, it just has
to be standard on each platform, which it is. There are really only two
ABIs in common use on x86, the System V ABI and the MS one (which apart
from the stdcall calling convention only differs in the bitfield layout

But within each platform it most definitely is the same between C
compilers[*], that's the whole point. These days there's even a standard
C++ ABI. That took ages to standardise, the C one has been around for
much much longer.


[*] On Windows gcc can do both normal and MS layout of bitfields.

More information about the Haskell-Cafe mailing list