From owner-freebsd-hackers Wed Jan 28 17:14:33 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA07957 for hackers-outgoing; Wed, 28 Jan 1998 17:14:33 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ns.mt.sri.com (sri-gw.MT.net [206.127.105.141]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA07881 for ; Wed, 28 Jan 1998 17:14:12 -0800 (PST) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id SAA04746; Wed, 28 Jan 1998 18:13:59 -0700 (MST) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id SAA07616; Wed, 28 Jan 1998 18:13:58 -0700 Date: Wed, 28 Jan 1998 18:13:58 -0700 Message-Id: <199801290113.SAA07616@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: John Polstra Cc: Nate Williams , hackers@FreeBSD.ORG Subject: Re: dladdr: Hel-lo-o-o? In-Reply-To: <199801290111.RAA01481@austin.polstra.com> References: <199801290057.RAA07509@mt.sri.com> <199801290111.RAA01481@austin.polstra.com> X-Mailer: VM 6.29 under 19.15 XEmacs Lucid Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk > > Is there an easy way for me to figure out how to check to see if it > > exists so that I can support both old and new systems? > > For a compile time check: That won't work, since I need run-time. :) > I think a run time check should be possible, too, though I haven't > tried it for this particular case: > > struct dl_info; > > #pragma weak dladdr > extern int dladdr(void *, struct dl_info *); > > if (&dladdr == 0) > /* It's not available. */ > else > /* It is available. */ Let me try this one. Is there any include files I need to get the definitions for dl_info and dladdr? > Don't ya just love it? If gcc tries to get too smart with you, you > might need to obfuscate the "&dladdr == 0" part. Gcc might try to > assume that the address of a global can't possibly be zero. That's pretty funky, and I hope it works. Nate