[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

autoconf macros and C++



I'm writing a program that uses the libapt-pkg library.  In my
configure.in I wanted to check to see if libapt-pkg.so was installed and
gve a warning if it isn't.  The way to do this I'm told is to use the
AC_CHECK_LIBS macro giving it the name of the library and a function in
that library.  autoconf writes a little program to see if it can link to
that function.  If it can it proves the library exists.

Sounds quite simple.  Trouble is it wouldn't work.  After 15 minutes of
total befuddlement it dawned on me why:  C++ mangles function names.  I
used objdump -T to get the mangled name, plugged that in and sure enough
it worked.

I hope this helps anyone who has faced the problem themselves.  I have a
question too, is there anyway to use the unmangled name?  AFAIK, mangling
isn't portable and unportability kind of defeats the whole purpose of
using autoconf don't you think?

-- 
Jaldhar H. Vyas <jaldhar@debian.org>



Reply to: