Bob Calco | 8 Jul 2007 16:47
Picon

Linking statically to libpq

I have built libpqxx-2.6.9 on windows (including implementing the 2 workarounds noted on the main page for Win32). All went well but I have a question.

 

I created libpqxx_static.lib but it seems to work against the libpq.dll by default and is even nice enough to copy it into the <src>/lib directory for me. I’d like it to link statically to libpq.lib and not require the DLL. Is it set up so that if I link my apps against the static versions of both libpq and libpqxx I won’t need the DLL, or is that just a hard requirement of using libpqxx—i.e., must include the libpq.dll?

 

What defines do I need to make that happen?

 

Thanks in advance!

 

-          Bob

 

_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@...
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general
Jeroen T. Vermeulen | 11 Jul 2007 08:44
Picon
Picon
Favicon

Re: Linking statically to libpq

On Sun, July 8, 2007 21:47, Bob Calco wrote:

Hello Bob,

My apologies for the late reply; I was unusually busy and hoped a Windows
user would pick it up.

> I created libpqxx_static.lib but it seems to work against the libpq.dll by
> default and is even nice enough to copy it into the <src>/lib directory
> for
> me. I'd like it to link statically to libpq.lib and not require the DLL.
> Is
> it set up so that if I link my apps against the static versions of both
> libpq and libpqxx I won't need the DLL, or is that just a hard requirement
> of using libpqxx-i.e., must include the libpq.dll?
>
> What defines do I need to make that happen?

In the latest versions, PQXX_PQ_STATIC should do it.  Look for that macro
in include/pqxx/compiler-public.hxx.  It's pretty new so you don't see it
there, then your version doesn't support it yet.  Try the latest
development snapshot here:

    http://pqxx.org/~jtv/tmp/pqxx/

Note that that version does have some problems with cursors and
robusttransactions at the moment.

Jeroen

Gmane