
On Sun, 14 Oct 2007, John Meacham wrote:
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.
This means, if this knowledge is baked into system dependent instances of Storable (especially 'alignment') then generic routines for constructing and disecting C structs are straightforward to implement. Right?