* dll_init.h (has_dtors): New flag.

(run_dtors): New wrapper function which avoids calling dtors more than once.
* dll_init.cc (dll_global_dtors): Use dll.run_dtors wrapper.
(dll_list::detach): Ditto.
(dll_list::alloc): Set has_dtors flag.
This commit is contained in:
Christopher Faylor
2009-08-21 21:32:06 +00:00
parent e41f43a1a6
commit 6282fe16dd
3 changed files with 22 additions and 2 deletions

View File

@ -50,10 +50,19 @@ struct dll
per_module p;
HMODULE handle;
int count;
bool has_dtors;
dll_type type;
WCHAR name[1];
void detach ();
int init ();
void run_dtors ()
{
if (has_dtors)
{
has_dtors = 0;
p.run_dtors ();
}
}
};
#define MAX_DLL_BEFORE_INIT 100