动态链接库搜索路径问题

mathe 2012-08-13 10:57:27
我现在有一台Windows7,现在自己写了一个动态链接库,然后将动态链接库的路径放入PATH环境变量中,
但是运行调用这个动态链接库的程序时,却报告无法找到这个动态链接库。如果将这个动态库拷贝到C:\windows或C:\windows\SysWOW64,就没有问题了。
请问大家这是什么原因,难道Windows7在DLL的搜索上不再支持PATH环境变量了?
...全文
203 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Gloveing 2012-08-17
  • 打赏
  • 举报
回复
不是啊,放到path变量里面肯定是可以找到的
If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended. However, the file name string can include a trailing point character (.) to indicate that the module name has no extension. When no path is specified, the function searches for loaded modules whose base name matches the base name of the module to be loaded. If the name matches, the load succeeds. Otherwise, the function searches for the file in the following sequence:

The directory from which the application loaded.
The current directory.
Windows XP: If HKLM\System\CurrentControlSet\Control\SessionManager\SafeDllSearchMode is 1, the current directory is the last directory searched. The default value is 0.

The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
Windows NT/2000/XP: The name of this directory is System32.

Windows NT/2000/XP: The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable.

18,124

社区成员

发帖
与我相关
我的任务
社区描述
Windows客户端使用相关问题交流社区
社区管理员
  • Windows客户端使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧