dlopen(), atexit() on FreeBSD
Markus Hoenicka
markus.hoenicka at mhoenicka.de
Sun Dec 30 09:52:14 PST 2007
Hi,
I bumped into a platform-specific problem when using the Firebird
database client library in a dlopen()ed module on FreeBSD. libdbi
(http://libdbi.sourceforge.net) is a database abstraction layer which
dlopen()s available database drivers at runtime to provide
connectivity to various database engines. This design works without
problems on a variety of platforms and with a variety of database
client libraries, but causes a segfault with Firebird on FreeBSD:
#0 0x28514fe4 in ?? ()
#1 0x281507c3 in __cxa_finalize () from /lib/libc.so.6
#2 0x281503fe in exit () from /lib/libc.so.6
#3 0x0804a40f in main (argc=1, argv=0xbfbfe754) at test_dbi.c:419
The application crashes when exit() is called. Googling told me that
__cxa_finalize () is invoked by atexit(). Our drivers and apps do not
use this function, but the firebird client libraries do:
markus at yeti:~/prog/libdbi-drivers/tests# grep atexit /usr/local/lib/libfb*
Binary file /usr/local/lib/libfbclient.so matches
Binary file /usr/local/lib/libfbembed.so matches
Googling also told me that the conflict between atexit() and dlopen()
on FreeBSD is a known problem, see e.g.:
http://www.imagemagick.org/pipermail/magick-developers/2006-March/002523.html
Is there anything I can do about this from my end?
regards,
Markus
--
Markus Hoenicka
markus.hoenicka at cats.de
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de
More information about the freebsd-questions
mailing list