Find libpq.dll version running on my pc for compiling against Postgres database

Viewed 290

I just compiled a new version of an executable file developed with DELPHI (XE6) running against Postgres 11.8 database. In order to distribute it, I believe I have to distribute the same version of libpq.dll that the program was compiled with, and simple as it seems, that is my problem, that among the many versions of libpq.dll that I have in my computer I don't know what is the actual one that Delphi is running locally and compiling with.

I tried to distribute the new version of the .exe file only (trying to run against the old version of libpq.dll) over the previous distribution, and it did not work (Throws an error when trying to open the first DB table)

The story is that I am new working with this program (And with Delphi also); There is a previous version of the program distributed on many PCs and working fine, I am just trying to distribute the new version that works fine on my PC. I installed 11.8 version of postgres (From the 9.5) on the server and the program distributed on all PCs kept working fine after the database actualization.

Thank you in advance any help will be kindly welcome.

2 Answers

You can find the version of the libpd.dll that your Delphi application load by using ProcessExplorer.

Run your program, connect to the database to be sure the DLL is loaded. Then run ProcessExplorer, find your application in the list, select it. Then use the tool to show all DLL loaded by your application. Locate libpq.dll in the list and right click properties. You'll get the info you want.

btw: You can also use ProcessMonitor to track which DLL is loaded, discover his path and then looking at the properties.

One way to obtain the version of a dll is get it from its version resource, like this:

function GetDLLVersion(const FullPathToDLL:string):string;
const
  dSize=$400;
var
  d:array[0..dSize-1] of byte;
  p:PVSFixedFileInfo;
  l:cardinal;
begin
  if GetFileVersionInfo(PChar(FullPathToDLL),0,dSize,@d[0]) then
    if VerQueryValue(@d[0],'\',pointer(p),l) then
      Result:=Format('%d.%d.%d.%d',[
        p.dwProductVersionMS shr 16,
        p.dwProductVersionMS and $FFFF,
        p.dwFileVersionLS shr 16,
        p.dwFileVersionLS and $FFFF]);
end;
Related