Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 From: "Dave Korn" To: Subject: RE: Static destructors not running Date: Tue, 10 May 2005 03:41:39 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <48781a66050509154660edcc78@mail.gmail.com> Message-ID: X-OriginalArrivalTime: 10 May 2005 02:41:24.0834 (UTC) FILETIME=[C208A420:01C55509] ----Original Message---- >From: William M. (Mike) Miller >Sent: 09 May 2005 23:46 > I'm sure this is the result of my having done something stupid > with the setup application, but suddenly static destructors no > longer run. That is, for the following program: > > #include > struct S { > S(); > ~S(); > } s; > S::S() { > printf("In ctor.\n"); > } > S::~S() { > printf("In dtor.\n"); > } > int main() { > printf("In main.\n"); > } > > the output is > > In ctor. > In main. > > The output "In dtor." is missing. That's because stdout is already closed by the time your dtor runs. I stepped right into it, it does the printf call but somewhere down in the dll it checks the flags field in the stdout FILE object for read/write and finds it's not open for either, so it's at eof. Grep 'cantwrite' if you really want to find it. Anyway, your dtor is called. cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/