DLL search path partially distorted

I just installed a new faster computer for my development station. I have a problem with a DLL that does not start when I run the application that I am working on using Delphi 6 Pro, but I don’t think the problem is with Delphi. Keep in mind that I have the same setup as the directories and tools on my old computer, and on this computer the DLL is detected at runtime without fail. The symptom, apparently, is that only some of the directories in my PATH environment variable are executed, and those that were recently added are not. I tried to put a directive containing the missing DLL in the current user PATH, and then the PATH and the DLL still could not be found.

Here are some facts:

  • The correct path for the DLL appears in the PATH environment variable if I run a command window and request PATH.

  • If I put the DLL in a directory such as the main Windows directory, it will be found at runtime.

  • If I use the Unix style β€œwhereis” using flounder.com, it finds the dll in PATH

  • I controlled the program at runtime using the Process Monitor utility (SysInternals was now Microsoft), so I could observe the system that was looking for the DLL. The system searched 7 out of 10 subdirectories along the way, but for some reason, as I said above, ignored 3 of them. Please note: I know that invalid directories are removed from the path, but I checked three times and they really are valid directories.

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

This is a really strange behavior that I have never seen before. It is as if there was a ghostly copy of the old PATH before some changes were made that the system uses when searching for DLLs.

Does anyone have any solutions or diagnostic ideas?

Thanks.

+1
source share
4 answers

Make sure that you change the PATH variable of the system (using the control panel), and then you start any process completely from fresh. If you have to start Delphi, change the path, then run the application in the debugger, then the new path will not be visible, because it inherits PATH from the startup process, which still has the old one. You must restart Delphi to see the new path.

+3
source

Shorten the PATH variable by removing unnecessary paths, just for testing. I saw how PATH gets too big after installing many programs that would like to change PATH. Although the PATH variable contained all valid paths, those that were at the end would not have been searched because there were too many of them.

+2
source

I had this problem yesterday, I used:

SetDLLDirectory(DirectoryPath:PWideChar) 

And that fixed, NT-based OS, apparently.

In addition, I would check that you did not miss the semicolon; (or sealed it as a colon :) between one of the path names in the list.

+1
source

Try if a subdirectory 7 or 8 is installed (illegal path).
I have seen examples where the search stops if an illegal entry is found.

+1
source

All Articles