Handle DLL search with two similar Windows applications
I have two windows applications that are very similar. The executables A.exe and B.exe must be kept separated, as well as one dll for each of them (libApp.dll, and I have one for A and one for B, different from each other). These executables however share a great deal of other .dlls.
Due to the nature of windows search path, one solution is to provide two directories, each containing all the dlls, the correct libApp.dll, and the correct executable. In fact, windows searches first the directory of the executable, then system directories, then everything in the Path variable.
At the moment, the above solution of two separated directories works, but it's extremely consuming in disk space. I would like to collate the common dlls in a common directory, and have A.exe and B.exe refer to this common directory for these dlls. To do so, I have to put this common dir in Path, but this has a slight issue: if the user installs a library with the same name in a standard windows path, that library will override mine, with horrible consequences.
On linux and OSX, there are envvars to specify the library search path, but on windows it's apparently way more complex. Does anybody know how this problem is generally solved?
链接地址: http://www.djcxy.com/p/7746.html