In my previous post Building client library (libpq.dll) with MinGW under Windows we have discovered the benefits of this approach. And these benefits were so good that we in microOLAP have even started to use our own built library in our PostgresDAC commercial product instead of the one shipped with PostgreSQL installer. For those who has chose this way either my warnings and advices.
In this post I will show you how to solve the issue of having different versions of DLL on the same machine. Talking about Windows environment only this time.
First of all we must remember about dependencies of libpq.dll library. In the case of official binaries built with MS Visual Studio such libraries must be present for correct work (for 8.3.6 version):
- comerr32.dll – COM_ERR – Common Error Handler for MIT Kerberos v5 / GSS distribution
- gssapi32.dll – GSSAPI – GSS API implementation for Kerberos 5 mechanism
- k5sprt32.dll – Kerberos v5 support – internal support code for MIT Kerberos v5 /GSS distribution
- krb5_32.dll – Kerberos v5 – MIT GSS / Kerberos v5 distribution
- libeay32.dll – OpenSSL Shared Library
- libiconv2.dll – LibIconv: convert between character encodings
- libintl3.dll – GetText: library and tools for native language support
- msvcr80.dll – Microsoft® C Runtime Library
- ssleay32.dll – OpenSSL Shared Library
Selected items present in %PostgreSQL%\bin folder, while the MS CRL must be installed separately. Which is done during PostgreSQL installation using Microsoft Visual C++ 2005 Redistributable Package (vcredist_x86.exe).
|Do not ever forget to provide your clients with Microsoft Visual C++ 2005 Redistributable Package (vcredist_x86.exe) if your application deployed with official client libraries.|
But if libpq.dll was built with MinGW, then you choose the dependencies, you choose what to inculde in your library. If there will be SSL or Kerberos support then you’ll need these libraries.
However, we must also remember that if OpenSSL is used, than different libraries must be shipped with libpq.dll
|Do not ever forget that OpenSSL libraries are different for MinGW and MSVC environments. And they are incompatible.|
From the previous post (link is above) you know that client library built with MinGW expects libssl32.dll library name, and libpq.dll built with MSVC expects ssleay32.dll library name. As for libeay32.dll the name is the same in both cases.
Often we meet the situation when some version of OpenSSL libraries already installed in the system, moreover installed into $Windows$\System32 folder.
|Always place OpenSSL libraries in the same folder as libpq.dll used by your application to avoid headache.|
That is pretty much it. Take care!