[prog] GNU autotools and namespaced libraries

Meredith L. Patterson mlp at thesmartpolitenerd.com
Thu Dec 16 16:53:02 EST 2004


John Clarke wrote:
> By "extern declaration", I'm assuming you mean that it's inside an
> 'extern "C" { ... }" block, i.e. it has C linkage and isn't name
> mangled.

Yes. And, as it turned out, I was able to pull off a slightly gratuitous 
hack which worked:

libpqxx depends on libpq, which is written in C. I used a parameterless 
function, PQenv2encoding, from libpq as the function argument to 
AC_CHECK_LIBS, then used '-lstdc++' as the OTHER-LIBRARIES argument. 
This took care of the unresolved-symbols problem like you suggested, and 
make now works just fine. (The entire macro was
AC_CHECK_LIB(pqxx, PQenv2encoding, , , [-lstdc++])
.)

Sneaky, but it worked -- I guess because PQenv2encoding is unmangled, 
not in a namespace, parameterless, and still technically part of libpqxx 
even though it doesn't actually live in it.

Thanks again, John!

Cheers,
Meredith


More information about the Programming mailing list