C++ shared lib unloading problems

Hi!

i can problems with unloading of shared object (s.o.)
which was written with C++

if s.o. was loaded by simplest program such as:

main(){
void* so1 = dlopen(“libcaoslog.so”, RTLD_NOW);
printf(“dlopen:%p\n”,so1);
if (!so1){
printf(dlerror());
exit(1);
}
dlclose(so1);
}

then “Memory fault” error occours (SIGSEGV)
during dlclose() !

Can somebody ideas?

fault of destructor of static data in some class?
or it is principal impossible to unload C++ s.o.?

Thanks!
vasa

then “Memory fault” error occours (SIGSEGV)
during dlclose() !

Seems FAQ but
did you compile the dll Position Independent (-fPIC, -shared, whatever)?

QNX doesn’t copy-on-write so crashes when
other OS silently do it (with penalty).

kabe

Yes, it’s possible. If it’s crashing during
the dlclose then it most probably is the
fault of a destructor.

vasilii <vv40in@rambler.ru> wrote:

Hi!

i can problems with unloading of shared object (s.o.)
which was written with C++

if s.o. was loaded by simplest program such as:

main(){
void* so1 = dlopen(“libcaoslog.so”, RTLD_NOW);
printf(“dlopen:%p\n”,so1);
if (!so1){
printf(dlerror());
exit(1);
}
dlclose(so1);
}

then “Memory fault” error occours (SIGSEGV)
during dlclose() !

Can somebody ideas?

fault of destructor of static data in some class?
or it is principal impossible to unload C++ s.o.?

Thanks!
vasa



cburgess@qnx.com

<kabe@sra-tohoku.co.jp> ÐÉÛÅÔ × ÓÏÏÂÝÅÎÉÉ:ad3jrr$3st$2@inn.qnx.com

then “Memory fault” error occours (SIGSEGV)
during dlclose() !

Seems FAQ but
did you compile the dll Position Independent (-fPIC, -shared, whatever)?

answer: YES

QNX doesn’t copy-on-write so crashes when
other OS silently do it (with penalty).

kabe

Thanks,
vasa