how operating system locates the dll for an applicaton
when it’s implicit linking an dll (dynamic-link library)
, the operating system will use the following algorithm for locating a DLL.
- The directory where the executable module for the current process is located.
- The current directory.
- The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
- The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
- The directories listed in the PATH environment variable.
when it’s explicit linking, one can specify the path
to the dll
file in the source c++ code.
reference
Application Specific Paths for DLL Loading
https://www.codeguru.com/cpp/w-p/dll/article.php/c99/Application-Specific-Paths-for-DLL-Loading.htm
应用程序如何找到DLL文件? - EverythingHere - 博客园
https://www.cnblogs.com/shangdawei/p/3537792.html