Delphi 2010: DLL doesn't load when executing binary from Delphi
I'm loading a DLL using LoadLibrary from my Delphi project like so:
DLLHandle := LoadLibrary('my.dll');
if (DLLHandle = 0) then ShowMessage(SysErrorMessage(GetLastError));
The directory where the DLL re开发者_开发知识库sides is included in the Windows PATH environment variable. When I execute this project from within Delphi, the DLL doesn't load. However, when the same code is exectued directly from Windows, the DLL loads perfectly.
What am I missing here? I've tried to explicitly tell Delphi to look in the directory of the DLL by adding the directory to the Tools->Options, Environment Options->Delphi Options->Library - Win32->Library Path. (It feels like an utter PEBKAC. I'm anticipating embarrasment for myself in the near future :) ...)
Thanks in advance!
Most of the time, when I have a similar problem(works from windows, not from debugger), it's because of "user overrides"
("Project->Options" menu, "Debugger->Environment block")
You might have an user override for the "Windows Path" which is why it doesn't work when ran from the debugger.
精彩评论