* 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:
@ -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
|
||||
|
Reference in New Issue
Block a user