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

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Jul 1 19:46:56 EDT 2009


On Thu, 2009-07-02 at 03:01 +0400, Bulat Ziganshin wrote:
> Hello Duncan,
> 
> Thursday, July 2, 2009, 2:57:29 AM, you wrote:
> 
> > 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
> > iirc).
> 
> you mean that on windows gcc, msvc and all other C compilers use the
> same ABI for passing and packing structs?

When using the gcc option -mms-bitfields then yes, gcc and msvc use the
same ABI for packing structs. As the name suggests, the only difference
otherwise is that MSVC uses a non-standard layout for bitfields, but
since it's the de-facto native compiler it kind of defines the native C
ABI. So as it happens this isn't relevant for the FFI because it does
not support bitfields.

Duncan




More information about the Haskell-Cafe mailing list