Discussion:
Force loading of DLL
(too old to reply)
dps
2010-03-01 18:43:09 UTC
Permalink
Hi all,

as far as I know static variables in a dll are initialized when the
dll is loaded. I have the following situation: my executable links
with a dll from which I use nothing explicitly. When the statics are
initialized, a function is registered with a map in another dll. If I
don't call a function from the first dll nothing is registered, as the
statics do not get initialized. Is there a way (and possibly platform-
independent) to initialize the statics in a dll without using anything
from it?

thanks a lot!
Nobody
2010-03-01 19:18:42 UTC
Permalink
Post by dps
Hi all,
as far as I know static variables in a dll are initialized when the
dll is loaded. I have the following situation: my executable links
with a dll from which I use nothing explicitly. When the statics are
initialized, a function is registered with a map in another dll. If I
don't call a function from the first dll nothing is registered, as the
statics do not get initialized. Is there a way (and possibly platform-
independent) to initialize the statics in a dll without using anything
from it?
Use LoadLibrary(), or add a dummy Init() function so the DLL is loaded when
you call it.

Continue reading on narkive:
Loading...