Re: building and analysing C structs with Storable

Henning Thielemann <[email protected]> Sun, 14 Oct 2007 22:05:27 +0200 (CEST)
Newsgroups gmane.comp.lang.haskell.libraries,gmane.comp.lang.haskell.ffi
Message-ID <[email protected]>
On Sun, 14 Oct 2007, Stefan O'Rear wrote:

> On Sun, Oct 14, 2007 at 09:28:45PM +0200, Henning Thielemann wrote:
>> Do different C compilers on the same platform actually use different
>> layouts for structs?
>
> Yes, because there are tradeoffs involved.  On x86, the optimal
> alignment for long double is 8 bytes, but a lot of people aren't crazy
> about 6 bytes of padding per 10 byte datum, so some compilers default to
> 4 byte alignment.
>
>> If yes, how can I find out, with which compiler a
>> library was compiled?
>
> Ask the person who did the compiling.

... but then c2hs cannot do it better (=automatically) than the "compiler 
dependent Haskell module" approach, can it?