vincent poortvliet
vincent poortvliet

Reputation: 97

How does windows handle loading two different versions of a DLL?

Question

I am writing a software that uses a specific DLL version. I have located the specific DLL in the execution directory, so the program uses that one. But now i don't know what happens if the specific DLL is loaded and a other program is started that need a newer version. Does anyone know what will happen? Does the other program crash or does mine crash?

Other

This question is for the OS: Windows 10 and windows 7. The workstation is is running windows updates so the DLL will be up to date. Writing code in C++.

Upvotes: 2

Views: 516

Answers (1)

mksteve
mksteve

Reputation: 13085

Different dlls can be loaded in different processes.

The address spaces of the different processes are independent, and will not interfere with each other.

If the DLL uses a global named thing (e.g. file on disk, mutex, shared memory), then the interoperability of the specific dll could interfere with each other.

If they had a single path to the database, which was at version 12, if the older DLL didn't understand version 12, it may crash.

Two different versions of the same DLL can be loaded using LoadLibrary into the same process. This will require one DLL being called through GetProcAddress, or some other secondary method, but both DLLs can exist and work in the same process.

Two DLLs in the same process can also interfere when accessing named objects.

Upvotes: 1

Related Questions