Alex Romosan wrote:

> Frederic Bouvier writes:
> 
> > So, if the library is really unloaded, the pointer access should be
> > really undefined and could lead to a segfault. Anyway, is it really
> > mandatory to do dlclose after getting the pointer ? It is if we do
> > dlopen every time we get a pointer, but the handle could be
> > allocated only once and stored for subsequent lookup.
> 
> that was my original "fix": comment out the call to dlclose(). if we
> keep things the way they are now, we should probably call dlopen()
> once, pass the handle, and at the end call dlclose().
> SGLookupFunction() should just call dlsym().

There is probably no problem of not doing dlclose at all. Standard 
process exit routine should do it for us. So we could write :

static void *handle = 0;
if ( !handle )
  handle = dlopen();
fct = dlsym();
return fct;

-Fred


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to