Reputation: 1376
When I copy the DLLs into the same folder where the .exe resides, it works. There is a (sort of) workaround for this, though: when I open the debugger options and add the original path of the DLL's to the environment block, it works when I start my project INSIDE my IDE, but it doesn't work when I start the project.exe file in explorer. This is not really an issue, I would just like to know the relationship between these files.
Upvotes: 1
Views: 1288
Reputation: 612934
When a DLL is linked by its name only, the DLL search path is used to locate it. This search path is a complicated beast that varies depending on a variety of settings. It is documented in some detail on MSDN.
In all variants of the DLL search path, the directory from which the executable was loaded is the first directory searched. This is by far the safest way to load a DLL. Requiring modifications to the global PATH
environment variable is invasive. Requiring DLLs to be installed in system directories is invasive and against all recommendations of best practice. Requiring the use of current directory is fragile and brittle and opens security vulnerabilities.
In an ideal world, applications should be isolated. And the most effective way to achieve that is to place dependencies in the same directory as the executable files.
Upvotes: 6