A quick question.
Is it possible for a dll to increase it?s own reference count, so it resides in memory after a process has called LoadLibrary and FreeLibrary?
I tried to have the dll call LoadLibrary on itself but it does not seem to work.

Clerihew
Posted on 2002-07-19 12:41:25 by clerihew
I would not recommend what you are doing, however, there is a structure in windows that contains the count of times the DLL is loaded.
You can use the HINSTANCE as a pointer to the structure and then increment the count.
Sorry I can not give you more details as it has been some time since I fiddled with this.

The other thing you could try is to make your dll statically link to the dll and thus create a circular reference.

Regs,
Posted on 2002-07-19 19:18:27 by James_Ladd