Static destructors not running

Reid Thompson reid.thompson@ateb.com
Tue May 10 01:55:00 GMT 2005


William M. (Mike) Miller wrote:

>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.
>
>I have tried to update all the gcc compilers and mingw libraries to
>the latest versions that the setup application allows me, on the
>assumption that somehow I managed to get an old version of a
>library during my last update, but nothing I have done restores the
>static destructor output.  From cygcheck, here are the versions of
>things I think might matter:
>
>    gcc                  3.4.1-1
>    gcc-ada              3.4.1-1
>    gcc-core             3.4.1-1
>    gcc-g++              3.4.1-1
>    gcc-g77              3.4.1-1
>    gcc-java             3.4.1-1
>    gcc-mingw            20040810-1
>    gcc-mingw-ada        20040822-1
>    gcc-mingw-core       20040822-1
>    gcc-mingw-g++        20040822-1
>    gcc-mingw-g77        20040822-1
>    gcc-mingw-java       20040822-1
>    mingw-runtime        3.7-1
>
>Anyone have any idea how I managed to do this to myself and,
>more importantly, how I can undo it?
>
>Thanks!
>
>  
>
sorry ---
#include <stdio.h>
struct S
{
    S();
    ~S();
} ;
S::S()
{
    printf("In ctor.\n");
}

S::~S()
{
    printf("In dtor.\n");
}

int
main()
{
    struct S          t;
    printf("In main.\n");
    t;
    return (0);
}


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



More information about the Cygwin mailing list