Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Dec 2007 18:49:44 +0100
From:      "Markus Hoenicka" <markus.hoenicka@mhoenicka.de>
To:        FreeBSD-questions@FreeBSD.org
Subject:   dlopen(), atexit() on FreeBSD
Message-ID:  <18295.55864.740395.631672@yeti.mininet>

next in thread | raw e-mail | index | archive | help
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@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@cats.de
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18295.55864.740395.631672>