delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/18/05:22:32

Message-ID: <3ADD5CC8.A0C7774D@ma.tum.de>
Date: Wed, 18 Apr 2001 11:22:16 +0200
From: Waldemar Schultz <schultzma AT mathematik DOT tu-muenchen DOT de>
X-Mailer: Mozilla 4.75 [de] (Win98; U)
X-Accept-Language: de,en-US
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
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> <3405-Tue17Apr2001180243+0300-eliz AT is DOT elta DOT co DOT il> <3ADC5E71 DOT 764DF1E6 AT ma DOT tum DOT de> <3ADC6312 DOT 225AF8FD AT falconsoft DOT be>
X-MIME-Autoconverted: from 8bit to quoted-printable by sunrbg2.mathematik.tu-muenchen.de id LAA06542
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id FAA00990
Reply-To: djgpp AT delorie DOT com

Tim Van Holder schrieb:
> 
> void
> write_struct(VP* obj, FILE* f)
> {
> char* name = obj->nam;
> char* beschreibung = obj->dsc;
>   obj->nam = (char*) strlen(name);
>   obj->dsc = (char*) strlen(beschreibung);
>   fwrite (obj, sizeof (*obj), 1, f);
>   fwrite (name, (int) obj->nam, 1, f);
>   fwrite (beschreibung, (int) obj->dsc, 1, f);
>   obj->nam = name;l
>   obj->dsc = beschreibung;
> }
> 
> void
> read_struct(FILE* f, VP* obj)
> {
> int len = 0;
>   fread (obj, sizeof (*obj), 1, f);
>   len = (int) obj->nam;
>   obj->nam = (char*) malloc(len + 1);
>   fread (obj->nam, len, 1, f);
>   obj->nam[len] = '\0';
>   len = (int) obj->dsc;
>   obj->dsc = (char*) malloc(len + 1);
>   fread (obj->dsc, len, 1, f);
>   obj->dsc[len] = '\0';
> }

That's nearly exactly who I do handle that.

Since there is a really heavy usage of those structs troughout the
project,
what I wanted to do is just leave alone the very large DJGPP program
which generates the data (writes the structures) as a normal coff
exe-file.
While the visiualisation program (reads and displays the structures
contents)
should run in a M$ window or console. So my idea was to simply
`port==compile'
it from DJGPP + GRX to MINGW + GRX.
(some people think an application is not serious if it doesn't run in a
window... ;)
If this had been possible, it would also have allowed to process already
existing data files without the need to regenerate them taking hours of
runtime.

BTW I couldn't resist to try the `-fpack-struct' switch Eli mentioned:
now MINGW reports the size of the struct being _97_ vs _88_ without the
switch.
DJGPP says _80_ , so indeed that's no help as predicted.

Many thanks for assistance, seems I'll have to go the hard and stony
way...

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


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