On Sat, Nov 05, 2005 at 07:01:46PM +0100, Axel Waggershauser wrote:

> I found out that linking explicitly with the static version
> (/usr/lib/libpqxx.a) works. Furthermore, I downloaded the upstream
> source tar ball, build the lib my self without removing the symbol
> information from the .so file and checked that the missing symbol is
> there:

I think I'm beginning to understand... This function is marked PQXX_PRIVATE.
And if you're using g++ 4.0, that means it is not exported from the shared
library.  The function is called from an inline function, so possibly from
the appplication's object files instead of from within the library binary.
If so, the linker will not be able to resolve do_startconnect()!

Now, the calling function is inline but also virtual, so one would expect
this not to matter.  In some cases it may conceivably be inlined despite
being virtual, in which case this would become a problem.  But I don't think
that's what's happening here: I think the problem is that all virtual
member functions in this class (including the calling function) are inline,
leaving the compiler no clear choice of object file to include the code for
that function in.  So it probably spews out copies of those functions in
each object file that sees a definition of the class.  Then it's up to the
linker to pick an implementation of the calling function out of the various
object files that define it--and if it happens to pick an implementation
from outside the library, then you get the link error.   More or less by
coincidence, really.

I hope this makes sense.  What I'm doing about it is to move the function
bodies for all virtual member functions in include/pqxx/connection.hxx
that call do_*connect() into src/connection.cxx.  That should mean that
all calls will come from within the library, and so the problem should go
away.  I'll also look for similar cases elsewhere.

Perhaps you can test this locally?


Jeroen

_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to