www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/04/21:20:35

Date: Tue, 4 Nov 1997 18:19:20 -0800 (PST)
Message-Id: <199711050219.SAA15069@adit.ap.net>
Mime-Version: 1.0
To: Chris Croughton <crough45 AT amc DOT de>, eyal DOT ben-david AT aks DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
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

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<djgpp_last_dtor-djgpp_first_dtor; i++)
      djgpp_first_dtor[i]();
  
    /* in case the program set it this way */
--- 28,36 ----
      a = a->__next;
    }
    for (i=0; i<djgpp_last_dtor-djgpp_first_dtor; i++)
      djgpp_first_dtor[i]();
+ 
+   if (__stdio_cleanup_hook)
+     __stdio_cleanup_hook();
  
    /* in case the program set it this way */
--cut--
Glad we got it resolved.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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