From owner-freebsd-hackers Mon Feb 3 5:47:30 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C7AF037B401 for ; Mon, 3 Feb 2003 05:47:27 -0800 (PST) Received: from mr3.bezeqint.net (mr3.bezeqint.net [192.115.106.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9757843F9B for ; Mon, 3 Feb 2003 05:47:26 -0800 (PST) (envelope-from stas@zend.com) Received: from mail.zend.com (bzq-117-235-230.cust.bezeqint.net [192.117.235.230]) by mr3.bezeqint.net (Mirapoint Messaging Server MOS 3.2.2-GA) with SMTP id AOQ56804; Mon, 3 Feb 2003 15:47:16 +0200 (IST) Received: (qmail 9541 invoked from network); 3 Feb 2003 13:47:12 -0000 Received: from shire.zend.office (10.1.1.11) by int.zend.com with SMTP; 3 Feb 2003 13:47:12 -0000 Date: Mon, 3 Feb 2003 15:47:12 +0200 (IST) From: Stanislav Malyshev X-X-Sender: frodo@shire.zend.office To: freebsd-hackers@FreeBSD.org Subject: How to make .so to find symbol from other .so? Message-ID: Organization: Zend Technologies Ltd (http://www.zend.com/) X-no-productlinks: yes MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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