www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
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 |
From: | "Dave Korn" <dave DOT korn AT artimi DOT com> |
To: | <cygwin AT cygwin DOT com> |
Subject: | RE: Static destructors not running |
Date: | Tue, 10 May 2005 03:41:39 +0100 |
MIME-Version: | 1.0 |
In-Reply-To: | <48781a66050509154660edcc78@mail.gmail.com> |
Message-ID: | <SERRANONlJbSorxTjtR000002ab@SERRANO.CAM.ARTIMI.COM> |
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 <stdio.h> > 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |