My basic issue is this: my program (MyProgram.exe) has a dependency on a DLL from another program (OtherProgram), and I\'m trying to avoid repackaging a new DLL every time Other
I have struggled with the same problem and also found a dead end with the suggested methods like LoadLibrary
, SetDllDirectory
, Qt's addLibraryPath
and others. Regardless of what I tried, the problem still remained that the application checked the libraries (and didn't find them) before actually running the code, so any code solution was bound to fail.
I almost got desperate, but then discovered an extremely easy approach which might also be helpful in cases like yours: Use a batch file! (or a similar loader before the actual application)
A Windows batch file for such a purpose could look like this:
@echo off
PATH=%PATH%;
/edit: Just saw @SirDarius comment in Luchian's answer which describes that way, so just take my batch code bit as a reference and all credits go to him.