I know that this was already discussed somewhere in here but I have not find question that I wanted, namely: I have a C++ application that uses a lot (more than 20 -30 ) DLLs. I have defined in my Visual Studio 2010 project that the .exe will be copied to the ProjectDir (so that everything is neat and clear) but when the .exe is standing in the ProjectDir alone it cannot access the DLLs stored in the bin..// whatever folder along with many other files.
Can I somehow point the DLL folder so that the application will know where they are located ? (and the <myapp>.exe.local
folder thing does not work in my Windows 7)
first of all there is no need to copy your exe file to your project dir, whereever your .exe file is created when you are debuging your project the running dir would be your project dir. and after that when you are trying to import the dll if you look for it relatively windows first search for that dll in your running dir then then it checks if it can find the dll in the whatever directory defined system PATH variable, but if you check for a absolute address there will be no looking.
so the first trick is to set all your dll pathes abslote so that there will be no searching and dll are imported easily but there will be a lot of problems if you want to move your application to another computer (eg HINSTANCE hDLL = LoadLibrary(L"C:\\mydll.DLL");
)
. second you can give your dll pathes relative to the running dir (not the application path, these 2 may differ) and you can also specify directory for that (eg. HINSTANCE hDLL LoadLibrary("..\\dlls\\mydll.dll")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With