Reputation: 83294
This is similar to the question here, but it pertains to the unmanaged C++ assemblies, instead of managed .Net ones.
Assuming that my application directory has its own Visual Studio Redistributable 2015 runtime DLLs ( I redistribute the runtime at app directory, just in case the client machine cannot install the VC++ redistributables from Windows update), and the client machine also has Visual Studio Redistributable 2015 package installed. Which one will get loaded, the vcruntime140.dll
located at the application directory, or the vcruntime140.dll
installed?
Similarly, my application directory has its own set of Universal C Runtime ( Again, I do this out of the reason that some client machines cannot install Universal CRT due to various reasons), and in the case the client machines also have Universal CRT installed, which one will get loaded, the installed Universal CRT DLLs, or the ones at my application directory?
For Windows 10 and Universal CRT, I know that the Universal CRT in the system directory is always used, even if an application includes an application-local copy of the Universal CRT. It's true even when the local copy is newer, because the Universal CRT is a core operating system component on Windows 10.
But I am not sure about other Windows 10, and above Visual Studio C++ redistributable package.
Thus I am looking for answers on all supported Windows versions, including Windows 7, Windows 8.1 and Windows 10.
Note: I am calling the unmanaged C++ assemblies from .Net, if that matters.
Upvotes: 1
Views: 181
Reputation: 1430
The load order for your CRT
dll's are in the following order:
You can place your runtime dll's in the app's current dir, and they should load. If you are compiling on Windows 10 and don't want UCRT
refrences, compile with /NODEFAULTLIB
Or, you can statically link to the CRT
libraries using the compile option /MT
Upvotes: 0