Specifying a DLL reference
- by Jesse
I'm having trouble setting the path to a DLL that is not in the same directory as the executable.
I have a reference to dllA.dll. At present, everything is just copied into the same directory and all is well; however, I need to move the executable to another directory while still referencing the DLL in the original directory.
So, it's setup like:
C:\Original\Dir
program.exe
dllA.dll
dllB.dll
dllC.dll
But I need to have it setup like:
C:\New\Dir
program.exe
dllB.dll
dllC.dl
Such that it is still able to reference dllA.dll in C:\Original\dir
I tried the following, but to no avail:
Set the "Copy Local" value to false for dllA.dll because I want it to be referenced in its original location.
Under "Tools Options Projects and Solutions VC++ Directories" I have added the path to "C:\Original\Dir"
Added "C:\Original\Dir" to both the PATH and LIB environment variables
At runtime, it informs me that it cannot locate dllA.dll Maybe the above steps I took only matter at compile time?
I was able to find this
http://stackoverflow.com/questions/1382704/c-specifying-a-location-for-dll-reference
But I was thinking that my above method should've worked.
Any ideas?