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

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <20100129200245.GA20829@ednor.casa.cgf.cx>
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>
Date: Fri, 29 Jan 2010 20:32:35 +0000
Message-ID: <416096c61001291232y6178e997na2db40bc32ff9a6b@mail.gmail.com>
Subject: Re: dlclose not calling destructors of static variables.
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
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

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. =C2=A0I 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.

Andy

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