Date: Tue, 4 Nov 1997 18:19:20 -0800 (PST) Message-Id: <199711050219.SAA15069@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Chris Croughton , eyal DOT ben-david AT aks DOT com From: Nate Eldredge Subject: Re: Writing to a file from dtor doesn't work! Cc: eliz AT is DOT elta DOT co DOT il, djgpp AT delorie DOT com Precedence: bulk At 06:12 11/4/1997 +0100, Chris Croughton wrote: >eyal DOT ben-david AT aks DOT com wrote: > >> I think that this sample should be checked with g++ on >> unix, to see if it is DJGPP specific problem. > >I just tested it with that exact program using GCC 2.7.2.2 >on DEC Alpha (OSF/1), and it works: [deleted] >It seems to be therefore a DJGPP bug (in the library? I'm >not sure which bit of it the startup/exit code is in). Okay, I think it's pretty well established that destructors should be run before all the files get closed. Here's the patch for exit.c (it should be fairly obvious to anyone who looks at it, but I just thought I'd put it out anyway): --cut-- *** src/libc/ansi/stdlib/exit.c~ Wed Jul 24 02:57:02 1996 --- src/libc/ansi/stdlib/exit.c Tue Nov 4 17:59:26 1997 *************** *** 28,35 **** a = a->__next; } - if (__stdio_cleanup_hook) - __stdio_cleanup_hook(); for (i=0; i__next; } for (i=0; i