
23 Jul
2004
23 Jul
'04
11:56 a.m.
Sorry for breaking into this discussion.
When a DLL is opened, Windows will implicitly call the exported initialization function. Whether or not your compiler uses this to run static initializers is up to the compiler vendor.
Understood. What happens in practice, say on VC?
This is the responsibility of the C-Runtime library. The static constructor list is getting called from the _DllMainCRTStartup which is the "true" entry point of the DLL. DllMain is getting called then in turn from within _DllMainCRTStartup. ( Please also note that DllMain is called BEFORE the runtime library has been initialized!) Roland