From owner-freebsd-questions@FreeBSD.ORG Mon Nov 17 23:13:35 2008 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 BF47D1065672; Mon, 17 Nov 2008 23:13:35 +0000 (UTC) (envelope-from markus.hoenicka@mhoenicka.de) Received: from smtprelay09.ispgateway.de (smtprelay09.ispgateway.de [80.67.29.23]) by mx1.freebsd.org (Postfix) with ESMTP id 4EC318FC1D; Mon, 17 Nov 2008 23:13:35 +0000 (UTC) (envelope-from markus.hoenicka@mhoenicka.de) Received: from [92.229.161.107] (helo=yeti.mininet) by smtprelay09.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1L2DHh-0005HQ-HB; Tue, 18 Nov 2008 00:13:33 +0100 X-Mailer: emacs 22.1.1 (via feedmail 8 I); VM 7.19 under Emacs 22.1.1 From: "Markus Hoenicka" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18721.64377.656498.977270@yeti.mininet> Date: Tue, 18 Nov 2008 00:17:13 +0100 To: Jeremy Chadwick , freebsd-questions@FreeBSD.org In-Reply-To: <18718.4273.817459.356946@yeti.mininet> References: <18715.28127.306511.577084@yeti.mininet> <20081113042912.GA10018@icarus.home.lan> <20081113090021.less3h5iwwsgwsg4@webmail.df.eu> <20081113081456.GA14564@icarus.home.lan> <20081113092059.gjjufgrxss0gwww0@webmail.df.eu> <20081113082402.GA14906@icarus.home.lan> <20081113121822.GA20600@icarus.home.lan> <18718.4273.817459.356946@yeti.mininet> X-Df-Sender: 472582 Cc: Subject: Re: dlsym can't use handle returned by dlopen? 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: Mon, 17 Nov 2008 23:13:35 -0000 Don't mean to nag, but is there any news on this? regards, Markus Markus Hoenicka writes: > Jeremy Chadwick writes: > > As promised: http://www.malkavian.com/~jdc/myprog.tar.gz > > > > This test program indeed works as expected. However, this doesn't > quite reflect the situation in libdbi. I took your files and modified > them accordingly, see: > > http://libdbi.sourceforge.net/downloads/dlsymtest.tar.gz > > To run the test use: > > LD_LIBRARY_PATH=. ./myprog > > We need to set the environment variable to let the linker pick up a > shared object that gmake builds. > > myprog.c now just calls a function which is provided in libmylib > (built from mylib.c). The latter file does most of what your test case > did in myprog.c. The second major change is that myshared.so is linked > against libmysqlclient (just like a libdbi database driver is linked > against the client library). myfunc now calls a MySQL function to show > that it is accessible (if you don't have libmysqlclient handy, you can > replace it with whatever function from some .so is convenient) > > Finally, libmylib tries to obtain a pointer to that MySQL function by > means of a dlsym call. This new dlsym call, in contrast to the existing > one that acesses myfunc in myshared.so, indeed fails: > > myint = 0xdeadbeef (3735928559) > ==> entered myfunc() > ==> double = 3.141590 > ==>mysql client version is 50051 > ==> exiting myfunc() > dlsym() in shared lib failed: Undefined symbol > "mysql_get_client_version" > > So, to make the problem clear again: while dlsym works when accessing > symbols in dlopen()ed objects, it fails to access symbols which are > linked into such an object if you use the handle returned by > dlopen(). This is different from other OSes. > > regards, > Markus > > > -- > Markus Hoenicka > markus.hoenicka@cats.de > (Spam-protected email: replace the quadrupeds with "mhoenicka") > http://www.mhoenicka.de > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- Markus Hoenicka markus.hoenicka@cats.de (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de