0

When I try to load a .dll then the application first try to load the .dll from their local folder, if it is not there they try to load it using the %PATH% environment variable.

I don't mind if the OS is doing any other searches, but I am interested in the order of the search in the %PATH% environment variable.

Now, let's assume I have two versions of theis dll, and both pathes of those dlls are in the %PATH% environment variable.

Am I guaranteed that the first path that is containing the .dll in the %PATH% environment variable, is the path which the .dll will be loaded from?

10x.

4

1 回答 1

0

搜索 DLL 有确切的顺序。

签出这个:

http://msdn.microsoft.com/en-us/library/7d83bc18%28v=vs.80%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx

更新:

Windows 将按照它们出现在 PATH 变量中的顺序进行搜索。请注意,完整的 PATH 变量由两部分组成:

系统:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATH

然后附加当前用户的 PATH : HKEY_CURRENT_USER\Environment\PATH

于 2012-05-30T14:40:33.063 回答