mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Use RTLD_NOLOAD, if it's supported.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33131 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f6496702aa
commit
928551c80a
1 changed files with 12 additions and 0 deletions
|
@ -62,6 +62,18 @@ __objc_dynamic_init(const char* exec_path)
|
|||
static dl_handle_t
|
||||
__objc_dynamic_link(const char* module, int mode, const char* debug_file)
|
||||
{
|
||||
#ifdef RTLD_NOLOAD
|
||||
/*
|
||||
* If we've got RTLD_NOLOAD, then ask the dynamic linker first to check if
|
||||
* the library is already loaded. If it is, then just return a handle to
|
||||
* it. If not, then load it again.
|
||||
*/
|
||||
void *handle = dlopen(module, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD);
|
||||
if (NULL != handle)
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
#endif
|
||||
return (dl_handle_t)dlopen(module, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue