hello people.
i have a problem with my .so .
i am dynamically loading and unloading my libtemp.so using the dlopen and dlclose functions.
my .so contains many global instances of many classes.
i can see that all my global constructors are called on load and all my destructors are called on unload.
everything seems fine.
but when my program ends, i get a segmentation fault error.
here is my main.cpp:
Code:
int main( int argc, char * argv[] )
{ 
if( argc != 2 ){
printf("usage [so name] \n");
return 0;
}
printf("Before Load\r\n");
void* pHandle = dlopen(argv[1]);
if( pHandle == NULL ){
printf("%s\r\n", dlerror());
}else{
printf("Load: Went fine\r\n");
if( dlclose(pHandle) ){
printf("UnLoad Went Ok\r\n");
}else{
printf("UnLoad Failed\r\n");
}
}
return 0;
}
the output will be:
Before Load
Load: Went fine
UnLoad Went Ok
Segmentation fault

when debugging, i can see that my main reached it's ending, but still i get the segmentation fault error.
what might caused the problem ?
is it some memory leak ?
one of my globals problems ?
i will appreciate any help, cause i am kind of lost here.
thanks