Mail Archives: djgpp/2001/04/17/10:30:10
I'm trying to port a DJGPP C-Program to MINGW32.
Problem: reading binary data into structures.
example:
typedef unsigned long ulg;
typedef unsigned int uint;
typedef double real;
typedef float sreal;
typedef long double lreal;
typedef unsigned char byte;
typedef signed char sbyte;
typedef signed char bool;
typedef struct vp
{
short vpi; /*Variablen-Index*/
char kenn; /*Kennung 'P'aram | 'K'onst | 'H'? */
short bs; /*zugeordnet zu Modul 'bs'*/
short opt; /*fuer BS-Option*/
short nr; /*als 'nr'*/
short me; /*Masseinheit*/
char * nam; /*Name*/
char * dsc; /*Beschreibung*/
real min; /*Minimalwert*/
real dft; /*default*/
real max; /*Maximalwert*/
ulg src; /*Herkunft aus Modul (bitcodiert)*/
ulg dst; /*Verwendung in Modul (bitcodiert)*/
ulg typ; /*findet Anwendung bei Knotentyp 'typ' (bitcodiert)*/
ulg kmb; /*findet Anwendung bei Modul-Kombination 'kmb'
(bitcodiert)*/
short brch; /*findet Anwendung bei Bereich 'brch' (bitcodiert)*/
short otyp; /**/
short omod; /**/
short odat; /**/
short olam; /**/
short ower; /**/
short imen; /**/
short imod; /**/
short idat; /**/
short na; /**/ /* dta -> alt */
}VP;
...
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?
--
Gruss Waldemar Schultz.
Technische Universität München, Zentrum Mathematik M1, D 80290 München
Tel: +49 (0)89 2892 8226 FAX: +49 (0)89 2892 8228
- Raw text -