Load libpq.dll with full path, so the LoadLibrary does not accidentally take a different (probably wrong) one from somewhere else than the current directory. See http://www.heidisql.com/forum.php?t=21039

This commit is contained in:
Ansgar Becker
2016-04-04 18:18:59 +00:00
parent bd63325a9f
commit bdddc726b4

View File

@ -2090,12 +2090,15 @@ end;
procedure TPgConnection.DoBeforeConnect;
var
LibWithPath: String;
begin
// Init lib before actually connecting.
// Each connection has its own library handle
if LibPqHandle = 0 then begin
Log(lcDebug, f_('Loading library file %s ...', [LibPqPath]));
LibPqHandle := LoadLibrary(PWideChar(LibPqPath));
LibWithPath := ExtractFileDir(Application.ExeName) + '\' + LibPqPath;
Log(lcDebug, f_('Loading library file %s ...', [LibWithPath]));
LibPqHandle := LoadLibrary(PWideChar(LibWithPath));
if LibPqHandle = 0 then
raise EDatabaseError.CreateFmt(_('Cannot find a usable %s. Please launch %s from the directory where you have installed it.'), [LibPqPath, ExtractFileName(ParamStr(0))])
else begin