Try to load libpq.dll with explicit file path if the path-less did not succeed. See http://www.heidisql.com/forum.php?t=22514

This commit is contained in:
Ansgar Becker
2016-11-20 21:20:41 +00:00
parent 41b7578c49
commit ce444cbfe4
2 changed files with 12 additions and 1 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2016-09-04 13:00+0200\n"
"PO-Revision-Date: 2016-11-20 22:19+0100\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/"
"language/en/)\n"
@ -4013,6 +4013,9 @@ msgstr "OLE DB property \"%s\": %s"
msgid "Loading library file %s ..."
msgstr "Loading library file %s ..."
msgid "Trying to load library with full path: %s"
msgstr "Trying to load library with full path: %s"
#. DLL loading fails on one procedure
msgid "Library error in %s: Could not find procedure address for \"%s\""
msgstr "Library error in %s: Could not find procedure address for \"%s\""

View File

@ -2117,12 +2117,20 @@ 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));
if LibPqHandle = 0 then begin
// Try with explicit file path if the path-less did not succeed. See http://www.heidisql.com/forum.php?t=22514
LibWithPath := ExtractFileDir(Application.ExeName) + '\' + LibPqPath;
Log(lcInfo, f_('Trying to load library with full path: %s', [LibWithPath]));
LibPqHandle := LoadLibrary(PWideChar(LibWithPath));
end;
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