dlclose and RTLD_GLOBAL
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > dlclose and RTLD_GLOBAL




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    dlclose and RTLD_GLOBAL  
Diego Santos


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-28-07 06:18 PM

Hi,
I have created an application that uses shared libs (plugins). I need
to load and unload the libs at run time.
I need to open the shared libs with RTLD_GLOBAL parameter and I open
all shared libs without any problems. But when I try to unload the
libs (dlclose), my application crashs (segmentation fault). If  I dont
use RTLD_GLOBAL, all works fine.

Here are a piece of my code that loads the libs:

while ( (temp=man->getActiveNameFromFile())!=NULL)
{
void *dlib;

dlib = dlopen(temp,RTLD_NOW|RTLD_GLOBAL);
liblist.push_back(dlib);
if (dlib  == NULL)
{
fl_alert(dlerror());
}
}


Note that I put all handles (void *) in a std::list.   The dlopen
works fine, all libs are loaded.
Then, I try to unload all libs as the following:

std::list<void *>::iterator it;

for (it=liblist.begin(); it!=liblist.end(); it++)
if (dlclose(*it))
printf("\nErro\n");

But the applications always crash here.

I have tried to use dlclose in reverse order too without success.

Please, can anyone help me?

I'd like to load and unload the shared libs dynamically, but I
couldn't unload it.

Thanks in advance,

Diego






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 07:04 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register