[Clam-devel] Re: Faust support - plugins dynamic reloading
Natanael Olaiz
nolaiz at gmail.com
Sat Aug 2 12:20:24 PDT 2008
I'm trying to reload the library (if exists) when open it. dlopen
(libraryName,RTLD_NOLOAD) returns NULL if not already loaded, the handle
if was loaded before. dlclose returns 0 is sucessful, other number if
error. (see http://linux.die.net/man/3/dlopen)
The following code remain in the while loop forever, like having
infinite references: no error, but don't finish to close the references.
Any idea? The previous loaded reference was using the same code (on
"first time opened").
//dlopen returns handle if opened, NULL if not
void * handle=dlopen(libraryPath.c_str(),RTLD_NOLOAD);
if (handle)
{
std::cout<<"opened before!\n Trying to unload"<<std::endl;
while ( (handle = dlopen(libraryPath.c_str(),RTLD_NOLOAD)) )
{
if (dlclose(handle))
{
std::cout<<"error! :(("<<std::endl;
std::cout<<dlerror()<<std::endl;
break;
}
}
}
else
{
std::cout<<"first time opened"<<std::endl;
}
return dlopen( libraryPath.c_str(), RTLD_NOW);
Regards,
Natanael
El 08/02/2008 06:28 AM, Natanael Olaiz escribió:
> Hi.
>
> Last night David made me realize that the used reload faust plugins
> just recreate the factory with new names making new creators which
> loads of the same dynamic plugin (and never delete the previous
> instances). I'm working on that, but I just want to advert that to you
> all. The release should not have that bug, so I expect to have it
> corrected ASAP.
>
>
> Regards,
> Natanael
>
More information about the clam-devel
mailing list