Attribute destructor function and C++ destructors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Just wanted to confirm whether the use of global static variables are allowed in attribute
constructor(foo_init)/destructor(foo_fini).

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?

Regards,
Simon

-- 

Search for products and services at: 
http://search.mail.com



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux