My program depends on Microsoft redistribute package, or to be more specific, depends on MSVCR100.dll
A recommanded approach is to install the redistribute package before my program running. However, my program is quite small(about 1MB), the vcredist.exe is about 5MB, it is a little too big for my installer.
So here is another way, according to license of Microsoft, we can install the dll into a subfolder(\VC\redist\x86\Microsoft.VC100.CRT\) in my application folder. So my application directory is like:
MyAppFolder\a.exe
MyAppFolder\lib\a.dll
MyAppFolder\VC\redist\x86\Microsoft.VC100.CRT\MSVCR100.dll
My question is, how do I make the a.dll find the MSVCR100.dll which located in another folder?
Just found a function – AddDllDirectory that can solve my problem.
Yes, I can link the CRT as a static library, but in my case there are several libraries that depend on it, which means every dll has a copy of MSVCR100.dll.