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.

  1. The directory where the executable module for the current process is located.
  2. The current directory.
  3. The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
  4. The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
  5. 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

posted on 2019-01-10 02:51  yusisc  阅读(22)  评论(0编辑  收藏  举报

导航