Mail Archives: djgpp/2001/04/17/11:06:07
> From: Waldemar Schultz <schultzma AT ma DOT tum DOT de>
> Newsgroups: comp.os.msdos.djgpp
> Date: Tue, 17 Apr 2001 16:29:25 +0200
>
> ...
> if(fread(vorp[i],sizeof(struct vp),nel=1,fp)!=nel) return ERROR
> ...
>
> this leads to vorp[] containing garbage, because of some alignment(?)
> issue:
> printing `sizeof(struct vp)' gives me _80_ under DJGPP, but _88_ under
> MINGW32.
>
> Does anybody know how to force the MINGW-gcc to use the same
> structure alignment / data storage scheme as DJGPP_GCC does, please?
You could probably make it work with the `-fpack-struct' switch, but
I'd suggest not to try: it's a futile exercise.
Either you need to read this struct from a program compiled by a
different compiler than the one used to write the struct, or you
don't. If you do need this, the best way is to read the data as a
byte stream into a buffer, then unpack the buffer into the struct
manually. But the best alternative is to read and write the file by
programs compiled with the same compiler.
- Raw text -