On Thu, 22 Feb 2007 17:18:12 +0100 Joerg.Schilling at fokus.fraunhofer.de 
(Joerg Schilling) wrote:
> Glenn Fowler <gsf at research.att.com> wrote:
> >     int b_test(int argc, char *argv[],void *extra)

> Well, I did plan to do something like:

> if ((fp = dlsym(RTLD_DEFAULT, "b_test")) != NULL)
>       we have b_test() available.

> The problem is that not all platforms might support RTLD_DEFAULT.

you can get a global handle from dlopen() using a path of 0:

  If the value of file is 0, dlopen() shall provide a handle on a global
  symbol object. This object shall provide access to the symbols from an
  ordered set of objects consisting of the original program image file,
  together with any objects loaded at program start-up as specified by
  that process image file (for example, shared libraries), and the set of
  objects loaded using a dlopen() operation together with the RTLD_GLOBAL
  flag. As the latter set of objects can change during execution, the set
  identified by handle can also change dynamically.

you may need to check for "_b_test" if "b_test" fails on some implementations

-- Glenn Fowler -- AT&T Research, Florham Park NJ --


Reply via email to