Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jan 1998 17:11:28 -0800
From:      John Polstra <jdp@polstra.com>
To:        Nate Williams <nate@mt.sri.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: dladdr: Hel-lo-o-o? 
Message-ID:  <199801290111.RAA01481@austin.polstra.com>
In-Reply-To: Your message of "Wed, 28 Jan 1998 17:57:25 MST." <199801290057.RAA07509@mt.sri.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > haven't received a single report.  Grrrrr.
>
> I've tried the patches, and they are indeed running on my 2.2.5
> system.  And, yes you did receive a single report pointing out a bug
> in the patch. :)

Well, besides that one. :-}

> 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:

    #include <link.h>

    #ifdef LDSO_VERSION_HAS_DLADDR
	...
    #endif

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. */

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.

John
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801290111.RAA01481>