This is the mail archive of the
mailing list for the GCC project.
Attribute destructor function and C++ destructors
- From: "Simon White" <s_a_white at email dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 17 Nov 2006 05:51:52 -0500
- Subject: Attribute destructor function and C++ destructors
Just wanted to confirm whether the use of global static variables are allowed in attribute
I have a shared library that in foo_init reads a file and writes to static global variables.
In foo_fini it writes that information (possibly modified) back to the file. Now under
gcc 4.0.1 (from MandrivaLinux 2006) I didn't see any issues. In gcc 4.1.1 (from
MandrivaLinux 2007) I've found the destructors for the globals are run before foo_fini,
causing problems for C++ objects (std::string in my case).
This does imply to me that if C++ globals are invalid then technically all globals are
invalid. So wanted to ask if this is a bug and/or what is the correct way to do this?
Search for products and services at: