aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/common/os/DynamicLibraryBundle.java2
-rw-r--r--src/java/com/jogamp/common/os/NativeLibrary.java64
-rw-r--r--src/java/jogamp/common/os/DynamicLinkerImpl.java11
-rw-r--r--src/java/jogamp/common/os/UnixDynamicLinkerImpl.java7
4 files changed, 48 insertions, 36 deletions
diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
index a3d6198..fee3c01 100644
--- a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
+++ b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
@@ -282,7 +282,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
}
} else {
if( null == dynLinkGlobal ) {
- dynLinkGlobal = lib.getDynamicLinker();
+ dynLinkGlobal = lib.dynamicLinker();
}
nativeLibraries.add(lib);
toolLibLoaded[i]=true;
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java
index 39d1475..1b05700 100644
--- a/src/java/com/jogamp/common/os/NativeLibrary.java
+++ b/src/java/com/jogamp/common/os/NativeLibrary.java
@@ -89,12 +89,17 @@ public final class NativeLibrary implements DynamicLookupHelper {
break;
case MACOS:
- case IOS:
prefixes = new String[] { "lib" };
suffixes = new String[] { ".dylib", ".jnilib" };
isOSX = true;
break;
+ case IOS:
+ prefixes = new String[] { "lib" };
+ suffixes = new String[] { ".dylib" };
+ isOSX = true;
+ break;
+
/*
case ANDROID:
case FREEBSD:
@@ -211,29 +216,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
loader);
Platform.initSingleton(); // loads native gluegen-rt library
- final DynamicLinker dynLink;
- switch (PlatformPropsImpl.OS_TYPE) {
- case WINDOWS:
- dynLink = new WindowsDynamicLinkerImpl();
- break;
-
- case MACOS:
- case IOS:
- dynLink = new MacOSXDynamicLinkerImpl();
- break;
-
- case ANDROID:
- if( PlatformPropsImpl.CPU_ARCH.is32Bit ) {
- dynLink = new BionicDynamicLinker32bitImpl();
- } else {
- dynLink = new BionicDynamicLinker64BitImpl();
- }
- break;
-
- default:
- dynLink = new PosixDynamicLinkerImpl();
- break;
- }
+ final DynamicLinker dynLink = getDynamicLinker();
// Iterate down these and see which one if any we can actually find.
for (final Iterator<String> iter = possiblePaths.iterator(); iter.hasNext(); ) {
@@ -312,7 +295,34 @@ public final class NativeLibrary implements DynamicLookupHelper {
return dynLink.lookupSymbolGlobal(funcName);
}
- /* pp */ final DynamicLinker getDynamicLinker() { return dynLink; }
+ /* pp */ final DynamicLinker dynamicLinker() { return dynLink; }
+
+ /* pp */ static DynamicLinker getDynamicLinker() {
+ final DynamicLinker dynLink;
+ switch (PlatformPropsImpl.OS_TYPE) {
+ case WINDOWS:
+ dynLink = new WindowsDynamicLinkerImpl();
+ break;
+
+ case MACOS:
+ case IOS:
+ dynLink = new MacOSXDynamicLinkerImpl();
+ break;
+
+ case ANDROID:
+ if( PlatformPropsImpl.CPU_ARCH.is32Bit ) {
+ dynLink = new BionicDynamicLinker32bitImpl();
+ } else {
+ dynLink = new BionicDynamicLinker64BitImpl();
+ }
+ break;
+
+ default:
+ dynLink = new PosixDynamicLinkerImpl();
+ break;
+ }
+ return dynLink;
+ }
/** Retrieves the low-level library handle from this NativeLibrary
object. On the Windows platform this is an HMODULE, and on Unix
@@ -433,9 +443,9 @@ public final class NativeLibrary implements DynamicLookupHelper {
// Add probable Mac OS X-specific paths
if ( isOSX ) {
// Add historical location
- addPaths("/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
+ addPaths("/Library/Frameworks/" + libName + ".framework", baseNames, paths);
// Add current location
- addPaths("/System/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
+ addPaths("/System/Library/Frameworks/" + libName + ".framework", baseNames, paths);
}
}
diff --git a/src/java/jogamp/common/os/DynamicLinkerImpl.java b/src/java/jogamp/common/os/DynamicLinkerImpl.java
index 56a909e..5ce94c1 100644
--- a/src/java/jogamp/common/os/DynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/DynamicLinkerImpl.java
@@ -144,14 +144,15 @@ import com.jogamp.common.util.SecurityUtil;
@Override
public final void closeLibrary(final long libraryHandle, final boolean debug) throws SecurityException, IllegalArgumentException {
final LibRef libRef = decrLibRefCount( libraryHandle );
- if( null == libRef ) {
- throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown.");
- }
- checkLinkPermission(libRef.getName());
+ if( null != libRef ) {
+ checkLinkPermission(libRef.getName());
+ } // else null libRef is OK for global lookup
if( DEBUG || debug ) {
System.err.println("DynamicLinkerImpl.closeLibrary(0x"+Long.toHexString(libraryHandle)+" -> "+libRef+")");
}
- closeLibraryImpl(libraryHandle);
+ if( 0 != libraryHandle ) {
+ closeLibraryImpl(libraryHandle);
+ }
}
protected abstract void closeLibraryImpl(final long libraryHandle) throws SecurityException;
diff --git a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
index 5e8ba9d..ddaeea2 100644
--- a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
@@ -49,15 +49,16 @@ package jogamp.common.os;
@Override
protected final long lookupSymbolLocalImpl(final long libraryHandle, final String symbolName) throws SecurityException {
- return dlsym(libraryHandle, symbolName);
+ return 0 != libraryHandle ? dlsym(libraryHandle, symbolName) : 0;
}
@Override
protected final void closeLibraryImpl(final long libraryHandle) throws SecurityException {
- dlclose(libraryHandle);
+ if( 0 != libraryHandle ) {
+ dlclose(libraryHandle);
+ }
}
-
@Override
public final String getLastError() {
return dlerror();