trouble with dlclose

Hi,

I am using dlfcn to load and unload plugins in an app I am currently
porting from linux to QNX RTP 6.1

All runs well until the calls to dlclose at the end of the program :

  • I tried dlopen(…, RTLD_NOW | RTLD_GLOBAL) first, and QNX reported a
    SIGSEGV Memory fault when dlclosing the !!LAST!! plugin, as if it were
    already dlclosed, I guess,

  • So I tried dlopen(…, RTLD_NOW) assuming it might be a problem of who
    depends on whom, and then I got SIGSEGV Memory fault when dlclosing the
    !!FIRST!! plugin, which I can’t explain

  • On linux 2.4.21 it worked well…

Does anyone see what happens there ?
And what if I don’t dlclose the modules ? aren’t they automatically
removed from memory space when the process exits ?

Thanks,

Yvain Thonnart

Hi again,

Trouble was the declaration of a header of the main app in the modules,
so dlclose seemed to want to close the symbols of the main app.

I made a custom header including only the functions from the main app I
needed, declared as extern “C”, and it seems to be working…

Is that what should be done, or is there a “cleaner” way to do it ?

Thanks

Yvain