From owner-freebsd-hackers Tue Mar 23 18:46:14 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.HiWAAY.net (fly.HiWAAY.net [208.147.154.56]) by hub.freebsd.org (Postfix) with ESMTP id 2B3C414C23 for ; Tue, 23 Mar 1999 18:45:43 -0800 (PST) (envelope-from sprice@hiwaay.net) Received: from localhost (sprice@localhost) by mail.HiWAAY.net (8.9.1a/8.9.0) with SMTP id UAA25461 for ; Tue, 23 Mar 1999 20:45:24 -0600 (CST) Date: Tue, 23 Mar 1999 20:45:24 -0600 (CST) From: Steve Price To: freebsd-hackers@freebsd.org Subject: dladdr(3) question Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi All, I know I'm probably doing something stupid here, but I seem to be having a problem getting dladdr(3) to work. Here's the code ... #include #include #include int foo() { return 0; } int main() { Dl_info dlinfo; if (dladdr(foo, &dlinfo) == 0) { printf("dladdr failed: %s\n", dlerror()); exit(1); } printf("dli_fname = %s\n", dlinfo.dli_fname); return 0; } ... and a couple of sample runs. bsd[~]$ ./a.out dladdr failed: Service unavailable bsd[~]$ uname -rs FreeBSD 4.0-CURRENT pepito[~]$ ./a.out dli_fname = a.out pepito[~]$ uname -rs SunOS 5.7 Anyone have any ideas where I'm missing the boat? -steve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message