Date: Mon, 3 Feb 2003 15:47:12 +0200 (IST) From: Stanislav Malyshev <stas@zend.com> To: freebsd-hackers@FreeBSD.org Subject: How to make .so to find symbol from other .so? Message-ID: <Pine.LNX.4.44.0302031538370.12459-100000@shire.zend.office>
next in thread | raw e-mail | index | archive | help
I have the following setup: Main executable loads module X, which in turn loads modules Y.so and Z.so (optionally, depending on the configuration). All loads are done with dlopen with flags RTLD_LAZY|RTLD_GLOBAL. Now, module Y needs to know address of some symbol from module Z in case Z.so is loaded. On linux and solaris, the code along these lines works: void *this_module = dlopen(NULL, RTLD_LAZY|RTLD_GLOBAL); return dlsym(this_module, symbol_name); However, on FreeBSD 3.4 and 4.0 it doesn't work - the dlsym returns NULL. The question is - how to make it work? I know that latest FreeBSD versions have dlsym(RTLD_DEFAULT, symbol_name), which is supposed to help. However, I need it to work on 3.4 and 4.0 too. What can be done about this? Is there any alternative way of doing this? The problem is that module Y doesn't also know the full path for Z.so, though it can know if it was loaded or not - thus I can not use dlopen with path name to go directly to Z.so. Any suggestions? -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.109 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0302031538370.12459-100000>