diff options
Diffstat (limited to 'src/java/jogamp/common/os/BionicDynamicLinkerImpl.java')
-rw-r--r-- | src/java/jogamp/common/os/BionicDynamicLinkerImpl.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java index b4ae70e..15d884f 100644 --- a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java @@ -55,7 +55,13 @@ public final class BionicDynamicLinkerImpl extends UnixDynamicLinkerImpl { // having to dlsym all entry points. System.loadLibrary() uses // RTLD_LOCAL visibility so can't be used for this purpose. SecurityUtil.checkLinkPermission(pathname); - return dlopen(pathname, RTLD_LAZY | RTLD_LOCAL); + final long handle = dlopen(pathname, RTLD_LAZY | RTLD_LOCAL); + if( 0 != handle ) { + incrLibRefCount(handle, pathname); + } else if ( DEBUG || debug ) { + System.err.println("dlopen \""+pathname+"\" local failed, error: "+dlerror()); + } + return handle; } @Override @@ -68,11 +74,18 @@ public final class BionicDynamicLinkerImpl extends UnixDynamicLinkerImpl { // having to dlsym all entry points. System.loadLibrary() uses // RTLD_LOCAL visibility so can't be used for this purpose. SecurityUtil.checkLinkPermission(pathname); - return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL); + final long handle = dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL); + if( 0 != handle ) { + incrLibRefCount(handle, pathname); + } else if ( DEBUG || debug ) { + System.err.println("dlopen \""+pathname+"\" global failed, error: "+dlerror()); + } + return handle; } @Override - public final long lookupSymbolGlobal(String symbolName) { + public final long lookupSymbolGlobal(String symbolName) throws SecurityException { + SecurityUtil.checkAllLinkPermission(); final long addr = dlsym(RTLD_DEFAULT, symbolName); if(DEBUG_LOOKUP) { System.err.println("DynamicLinkerImpl.lookupSymbolGlobal("+symbolName+") -> 0x"+Long.toHexString(addr)); |