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 To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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