building and analysing C structs with Storable

John Meacham john at repetae.net
Sun Oct 14 23:51:13 EDT 2007


On Sun, Oct 14, 2007 at 09:28:45PM +0200, Henning Thielemann wrote:
> >You say "the system's C compiler" as if there was only one.  It's quite
> >common for UNIXoid systems to have several C compilers installed
> >simultaneously; and if you use the module corresponding to the wrong
> >compiler, you get silent data loss.  I wouldn't risk it.
> 
> Do different C compilers on the same platform actually use different 
> layouts for structs? If yes, how can I find out, with which compiler a 
> library was compiled?

Not in general, the exact layout of C structs and whatnot is set forth
in the ABI spec developed by the chip manufacturer. All compilers must
follow it or they cannot even use the same libraries. that said, some
compilers out there do sometimes deviate from the ABI, or allow it as an
option, but there is generally an accepted ABI for a OS-platform pair.
Otherwise things like 'libc' would not be abled to be linked against.

for instance the ABI for x86-64 is here
http://www.x86-64.org/documentation/abi-0.98.pdf


        John


-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Libraries mailing list