delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/17/11:06:07

Date: Tue, 17 Apr 2001 18:02:43 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Waldemar Schultz <schultzma AT ma DOT tum DOT de>
Message-Id: <3405-Tue17Apr2001180243+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <3ADC5345.8D25094F@ma.tum.de> (message from Waldemar Schultz on
Tue, 17 Apr 2001 16:29:25 +0200)
Subject: Re: MINGW vs DJGPP
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010417165008 DOT 15278J-100000 AT is> <9bhhqg$bfo$1 AT talia DOT mad DOT ttd DOT net> <3ADC5345 DOT 8D25094F AT ma DOT tum DOT de>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019