I am trying to get the PhoenixSingleton pattern example found in
"Modern C++ Design" to run. I am using the Singleton in a DLL.
I don't deliver any references of the Singleton to outside-DLL callers
so that's not my problem. The singleton works perfectly, the only
problem is.. after reviving the singleton, it doesn't get destroyed,
meaning the destructor is not called.
I checked that by using the DLL in a simple test application and
sending messages to std::cout in every member function.
Every single function is called in the correct order as soon as the DLL
is unloaded, the Singleton gets destroyed for the first time, it gets
revived.. but the destructor doesn't get called a second time.
Somehow I suspect atexit() doesn't work here.
I am using Visual Studio 2005 and I already tried using _onexit() but
that thing doesn't seem to accept member function pointers at least
I always get conversion errors there.
Any ideas or insights on how to get this to work?
The object that I put into the singleton is just a simple logging class
that I use in my application to write simple statements to a textfile
and that holds only a fstream object, so when the application is
terminated there shouldn't be any ressource leaks even if the destructor
isn't called but being the perfectionist I am I'd like this to work as
it is supposed to.
Thanks in advance
A. Schmitt