DLL搜索路径仅部分搜索 [英] DLL Search Path only partially searched

查看:148
本文介绍了DLL搜索路径仅部分搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚设置了一台新的更快的电脑作为我的开发站。当我运行一个应用程序我正在使用Delphi 6 Pro时,我遇到一个DLL没有开始的问题,但我不认为Delphi的问题。记住,我有一个完全相同的设置,只要目录和工具在我的旧电脑和该计算机上的DLL在运行时找不到失败。症状似乎只是我的PATH环境变量中的一些目录被搜索,最近添加的目录不是。我已经尝试将包含缺少的DLL的目录放在当前用户PATH中,然后在系统PATH中仍然找不到。



这里有一些事实:




  • 如果我运行命令窗口并查询PATH,那么DLL的正确路径会显示在PATH环境变量中。


  • 如果我将DLL放在像Windows主目录这样的目录中,它会在运行时找到。


  • 如果我使用Unix风格whereis的利用形式为flounder.com,它会在PATH中找到该DLL


  • 我监视程序在运行时(SysInternals现在是微软的)Process Monitor实用程序,所以我可以看系统搜索DLL。该系统在路径中搜索了10个子目录中的7个,但由于某些原因,如上所述,忽略其中3个。注意,我知道无效的目录是从路径中删除的,但是我进行三重检查,它们确实是有效的目录。


  • 最后我创建了一个C:\DUMMY目录,并将该目录添加到PATH环境变量中,当我检查过程监视器时,该目录也从未被搜索。




这是我以前从未见过的真正奇怪的行为。就好像有一个旧的PATH的ghost副本,在系统在搜索DLL时正在使用某些修改之前。



有人有解决方案或诊断思路吗?



谢谢。

解决方案

确保您正在更改系统PATH变量(使用控制面板),然后您将从新鲜完全启动任何进程。如果要运行Delphi,请更改路径,然后在调试器中运行该应用程序,否则将不会看到新的路径,因为它将继续从启动进程(仍然有旧路径)继续路径。您应该重启Delphi,让它看到新的路径。


I just set up a new faster computer to be my development station. I'm having a problem with a DLL not begin found when I run an application I'm working on using Delphi 6 Pro, but I don't think the problem is with Delphi. Keep in mind, I have the exact same setup as far as directories and tools on my old computer and on that computer the DLL is found at runtime without fail. The symptom appears to be that only some of the directories in my PATH environment variable are being searched, and the ones added most recently are not. I have tried putting the diretory that contains the missing DLL in the current user PATH and then in the system PATH and the DLL still can not be found.

Here are some facts:

  • The correct path for the DLL does appear in the PATH environment variable if I run a Command Window and query the PATH.

  • If I put the DLL in a directory like the the Windows main directory it is found at runtime.

  • If I use the Unix style "whereis" utilty form flounder.com it does find the DLL in the PATH

  • I monitored the program at runtime with (was SysInternals now Microsoft's) Process Monitor utility so I could watch the system searching for the DLL. The system did search 7 out of the 10 sub-directories in the path but for some reason, as I said above, ignored 3 of them. Note, I know invalid directories are stripped from the path but I triple-checked and they are indeed valid directories.

  • Finally I created a C:\DUMMY directory and added that directory to the PATH environment variable and when I checked Process Monitor, that directory too was never searched.

This is really strange behavior that I've never seen before. It's as if there's a ghost copy of the old PATH before certain modifications were made to it that the system is using when searching for DLLs.

Does anybody have a solution or diagnostic ideas?

Thanks.

解决方案

Be sure you are changing the system PATH variable (using the Control Panel), and that you are then launching any process completely from fresh. If you were to run Delphi, change the path, then run the app in the debugger, then the new path will not be seen because it will inherit the PATH from the launching process, which still has the old one. You should restart Delphi to get it to see the new path.

这篇关于DLL搜索路径仅部分搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆