[Haskell-cafe] Re: Could FFI support pass-by-value of structs?
John Meacham
john at repetae.net
Mon Jul 6 21:48:10 EDT 2009
On Thu, Jul 02, 2009 at 03:01:48AM +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?
Yes. If you think about it, otherwise it would be impossible to
interface with system provided shared libraries (like libc) unless there
is a standard.
It sometimes varies across different OS's, but for any
OS/chip combo there is a single defined C ABI. It is generally called
the 'system V' ABI for historical reasons, even though chances are
people arn't using it for system V. Usually it is provided by the chip
manufacturer and all OS's follow it. Unless they feel like being a PITA,
but in that case they have their own standards document that gcc will
follow as an option. So, yes. there is always _some_ well defined ABI
for the C langauge on a given platform.
John
--
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
More information about the Haskell-Cafe
mailing list