-
DLL Load issue
Hello everyone,
I am developing a DLL and I implement a class in the DLL. I am wondering in the two situations,
1. DLL is loaded by a single process multiple times
2. DLL is loaded a couple of times by multiple process
How much times will the constructor be invoked? I want to learn how objects inside a DLL is shared between different process. Is it possible to make multiple process share one single class (class is defined in DLL) object instance?
thanks in advance,
George
-
A normal program doesn't load a DLL multiple times. When you call LoadLibrary on the same DLL two times, it doesn't load it again on the second time, it just gives you the handle of the current one (and increments the load counter). Only LoadLibrary, FreeLibrary, LoadLibrary, FreeLibrary would result loading and unloading the DLL two times.
-
>> Is it possible to make multiple process share one single class (class is defined in DLL) object instance?
No, each process that loads a DLL has it's own seperate memory spaces for it.