From owner-freebsd-questions@FreeBSD.ORG Sun Dec 30 17:52:14 2007 Return-Path: Delivered-To: FreeBSD-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCC716A418 for ; Sun, 30 Dec 2007 17:52:14 +0000 (UTC) (envelope-from markus.hoenicka@mhoenicka.de) Received: from rrzmta1.rz.uni-regensburg.de (rrzmta1.rz.uni-regensburg.de [194.94.155.51]) by mx1.freebsd.org (Postfix) with ESMTP id D6B6213C442 for ; Sun, 30 Dec 2007 17:52:13 +0000 (UTC) (envelope-from markus.hoenicka@mhoenicka.de) Received: from rrzmta1.rz.uni-regensburg.de (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 930C550632 for ; Sun, 30 Dec 2007 18:52:10 +0100 (CET) Received: from yeti.mininet (rrzras1-15.rz.uni-regensburg.de [132.199.208.25]) by rrzmta1.rz.uni-regensburg.de (Postfix) with ESMTP id A655E50B32 for ; Sun, 30 Dec 2007 18:52:04 +0100 (CET) X-Mailer: emacs 21.3.1 (via feedmail 8 Q); VM 7.19 under Emacs 21.3.1 From: "Markus Hoenicka" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18295.55864.740395.631672@yeti.mininet> Date: Sun, 30 Dec 2007 18:49:44 +0100 To: FreeBSD-questions@FreeBSD.org Cc: Subject: dlopen(), atexit() on FreeBSD X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Dec 2007 17:52:14 -0000 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