Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jan 1998 18:13:58 -0700
From:      Nate Williams <nate@mt.sri.com>
To:        John Polstra <jdp@polstra.com>
Cc:        Nate Williams <nate@mt.sri.com>, hackers@FreeBSD.ORG
Subject:   Re: dladdr: Hel-lo-o-o? 
Message-ID:  <199801290113.SAA07616@mt.sri.com>
In-Reply-To: <199801290111.RAA01481@austin.polstra.com>
References:  <199801290057.RAA07509@mt.sri.com> <199801290111.RAA01481@austin.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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



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