delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/29/15:42:27

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 29 Jan 2010 15:42:09 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: dlclose not calling destructors of static variables.
Message-ID: <20100129204209.GB20829@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4B61732F DOT 4030804 AT gmail DOT com> <4B62DDE6 DOT 5070106 AT gmail DOT com> <4B62F118 DOT 8010305 AT gmail DOT com> <20100129184514 DOT GA9550 AT ednor DOT casa DOT cgf DOT cx> <4B633439 DOT 6030609 AT gmail DOT com> <20100129200245 DOT GA20829 AT ednor DOT casa DOT cgf DOT cx> <416096c61001291232y6178e997na2db40bc32ff9a6b AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <416096c61001291232y6178e997na2db40bc32ff9a6b@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Fri, Jan 29, 2010 at 08:32:35PM +0000, Andy Koppe wrote:
>Christopher Faylor:
>> Andrew West:
>>>O.k. I'll check out the changes on Monday, but one minor point.
>>>Shouldn't the atexit stuff be run after all the destructors have run?
>>
>> Not if the output from the linux version of your program is to be
>> believed. ??I originally had the atexit stuff run after the dtors and saw
>> this:
>>
>> testlib:: stop
>> TestClass::~TestClass()
>>
>> Putting the atexit stuff first reversed the order, making it match
>> linux.
>
>The C++ standard requires static destructors and atexit functions to
>be executed in the opposite order that the corresponding constructors
>were invoked and the atexit functions were registered. Since atexit()
>may be called from static constructors, there should theoretically be
>a single stack for destructors and atexit functions. But if that's not
>practical, invoking the atexit stuff first is a fairly decent
>approximation.

Actually, it really isn't if gcc is calling atexit under the hood since
that muddies the waters considerably.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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