On Sunday 27 June 2004 03:28 pm, Alex Romosan wrote:
> Frederic Bouvier <[EMAIL PROTECTED]> writes:
> > Alex Romosan wrote:
> >> "Frederic Bouvier" writes:
> >> > The fact that you are using the function pointer *after* dlclose
> >> > is as broken as Erik's version. This is not good practise to
> >> > bet on side effects that are beyond your control.
> >>
> >> _NO_, because the pointer now points to an object in memory in the
> >> scope of the program which is guaranteed to be always the same. this
> >> is equivalent to just calling dlsym(RTLD_DEFAULT,func). incidentally,
> >> on linux RTLD_DEFAULT is defined to be 0, but on solaris is -2. i wish
> >> i still had an irix machine....
> >
> > So you're just guessing. The cvs version is assured to work on any
> > system.
> guessing about what? the version in cvs is ugly because it never calls
> dlclose(). the last version i proposed assigns a pointer in the scope
> of the program which is guaranteed to stay same for the lifetime of
> the program (even after calling dlclose()). no guessing there. the
> irix 5.3 man page states that dlopen(0,...) is supported on irix as
> well so that solution is portable.
> i wish i still had an irix machine so i could look if RTLD_DEFAULT is
> defined in dlfcn.h. if it is, we can then call
> dlsym(RTLD_DEFAULT,func) directly.
> --alex--

In dlfcn.h we find:
/* Unmap and close a shared object opened by `dlopen'
   The handle cannot be used again after calling `dlclose'.  */
extern int dlclose (void *__handle) __THROW;

Also RTLD_DEFAULT is a gnu extension and requires 
__USE_GNU to be defined

Richard Harke

Flightgear-devel mailing list

Reply via email to