开发者

DLL Search Path only partially searched

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 M开发者_运维技巧onitor, 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.


Shorten the PATH variable by removing unnecessary paths, just for testing. I've seen the PATH grow to be too large after installation of many pieces of software that like to modify the PATH. Although the PATH variable contained all valid paths, the ones at the end would not be searched since there were too many.


Try to se if the subdiretory 7 or 8 is incorrent (illegal path).
I have seen examples where the search stops, if an illegal entry is found.


I had this very problem yesterday, I used:

SetDLLDirectory(DirectoryPath:PWideChar)

And this fixed it, NT based OS only apparently.

Also, I would check to make sure that you've not missed a semicolon ; (or mistyped it as colon :) from between one of the path names in the list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜