RTLD_NOLOAD may not always be loaded

dlopen should always have a matching dlclose.
This commit is contained in:
Vítor Santos Costa 2012-09-07 07:40:18 +02:00
parent dcc5b57016
commit 9019a1a7b7

View File

@ -36,7 +36,9 @@ Yap_CallFunctionByName(const char *thing_string)
{
void * handle = dlopen(NULL, RTLD_LAZY
#ifndef __CYGWIN__
#ifdef RTLD_NOLOAD
| RTLD_NOLOAD
#endif
#endif
);
// you could do RTLD_NOW as well. shouldn't matter
@ -47,6 +49,7 @@ Yap_CallFunctionByName(const char *thing_string)
prismf * addr = (prismf *)dlsym(handle, thing_string);
if (addr)
(*addr)();
dlclose(handle);
return TRUE;
}