Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Nov 2008 00:59:27 +0100
From:      "Markus Hoenicka" <markus.hoenicka@mhoenicka.de>
To:        freebsd-questions@freebsd.org
Subject:   dlsym can't use handle returned by dlopen?
Message-ID:  <18715.28127.306511.577084@yeti.mininet>

next in thread | raw e-mail | index | archive | help
Hi,

FreeBSD yeti.mininet 6.1-RELEASE FreeBSD 6.1-RELEASE #1: Mon Aug 28 22:24:48 CEST 2006     markus@yeti.mininet:/usr/src/sys/i386/compile/YETI  i386

I'm trying to do the following: libdbi (http://libdbi.sourceforge.net)
is a database abstraction layer which is linked as a shared object
into applications. The libdbi library uses dlopen() to load database
drivers which in turn are linked against database client
libraries. Now I want to access functions defined in the database
client library from within the libdbi library. In brief, I thought
this is going to work like this:

dlhandle = dlopen("path", RTLD_NOW);
...
function_pointer = dlsym(dlhandle, "function_name");

dlhandle is not NULL and does not crash the app when passed to
dlclose(), so I assume the handle is valid. Accessing the functions
does work on most systems (Linux, OSX, Cygwin, to name a few), but I
get "Undefined symbol" errors on FreeBSD. Interestingly, the following
does work:

function_pointer = dlsym(RTLD_DEFAULT, "function_name");

Why is that? Or rather: what am I doing wrong?

Any help is appreciated.

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?18715.28127.306511.577084>