When using LoadLibrary on the same file twice, simply a DLL reference counter is increased. Is it possible to load a DLL twice and let it become 2 independent copies, just like loading two DLL files?
have you checked to see if it returns the same handle if so theres your answer... im not sure my self..
I think its possible to do that by loading same dll on different base addresses in each .exe memory space, but why do you need all this for?
but how?
I need 2 duplicated copy of a DLL threads in my 8051 Emulator so that 2 CPUs can be emulated easily.
I need 2 duplicated copy of a DLL threads in my 8051 Emulator so that 2 CPUs can be emulated easily.
If you launch the emulator program twice, you will get two virtual CPUs, each with its own "copy" of the DLL. However, they will not be synchronized with each other.
To get two copies in the same process (executable), I would try putting a copy of the DLL in another directory and loading the DLLs from the different directories. If it works, then I would create directories on-the-fly for each processor I wanted to create.
To get two copies in the same process (executable), I would try putting a copy of the DLL in another directory and loading the DLLs from the different directories. If it works, then I would create directories on-the-fly for each processor I wanted to create.
that means keeping 2 copies of the same DLL file?
but how?
I need 2 duplicated copy of a DLL threads in my 8051 Emulator so that 2 CPUs can be emulated easily.
Why not just create 2 threads and call the appropriate functions in the DLL?
yeah, that's something. let me try.
hi optimus
i feel that it is possible to load a dll twice by using an artful protection scheme by accessing the file by its alternate short name, leaving the system loader in delusion and loading them in 2 addresses.
thank you
nickdigital
i feel that it is possible to load a dll twice by using an artful protection scheme by accessing the file by its alternate short name, leaving the system loader in delusion and loading them in 2 addresses.
thank you
nickdigital
if the dll is thread-aware (it allocates a new portion of the memory for every new thread at DLL_THREAD_ATTACH, and deallocates it at DLL_THREAD_DETACH) you can just use LoadLibrary() twice on 2 different threads (or even 1 - i can't remember now). if not - the only option is to cheat somehow - use two copies, or play with processes and filemapping for synchronization, etc.