summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/os')
-rw-r--r--src/java/com/jogamp/common/os/DynamicLinker.java1
-rw-r--r--src/java/com/jogamp/common/os/NativeLibrary.java25
2 files changed, 20 insertions, 6 deletions
diff --git a/src/java/com/jogamp/common/os/DynamicLinker.java b/src/java/com/jogamp/common/os/DynamicLinker.java
index 32aa7eb..b1671b9 100644
--- a/src/java/com/jogamp/common/os/DynamicLinker.java
+++ b/src/java/com/jogamp/common/os/DynamicLinker.java
@@ -51,4 +51,5 @@ public interface DynamicLinker {
public long lookupSymbol(long libraryHandle, String symbolName);
public long lookupSymbolGlobal(String symbolName);
public void closeLibrary(long libraryHandle);
+ public String getLastError();
}
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java
index bfc5b07..3009ef3 100644
--- a/src/java/com/jogamp/common/os/NativeLibrary.java
+++ b/src/java/com/jogamp/common/os/NativeLibrary.java
@@ -186,13 +186,26 @@ public class NativeLibrary implements DynamicLookupHelper {
for (Iterator<String> iter = possiblePaths.iterator(); iter.hasNext(); ) {
String path = iter.next();
if (DEBUG) {
- System.err.println("NativeLibrary.open(): Trying to load " + path);
+ System.err.println("NativeLibrary.open(global "+global+"): Trying to load " + path);
}
long res;
- if(global) {
- res = dynLink.openLibraryGlobal(path, DEBUG);
- } else {
- res = dynLink.openLibraryLocal(path, DEBUG);
+ try {
+ if(global) {
+ res = dynLink.openLibraryGlobal(path, DEBUG);
+ } else {
+ res = dynLink.openLibraryLocal(path, DEBUG);
+ }
+ } catch (Throwable t1) {
+ if( DEBUG ) {
+ System.err.println("NativeLibrary.open: Catched "+t1.getClass().getSimpleName()+": "+t1.getMessage());
+ String errstr;
+ try {
+ errstr = dynLink.getLastError();
+ } catch (Throwable t2) { errstr=null; }
+ System.err.println("NativeLibrary.open: Last error "+errstr);
+ t1.printStackTrace();
+ }
+ res = 0;
}
if (res != 0) {
return new NativeLibrary(res, path, global);
@@ -200,7 +213,7 @@ public class NativeLibrary implements DynamicLookupHelper {
}
if (DEBUG) {
- System.err.println("NativeLibrary.open(): Did not succeed in loading (" + windowsLibName + ", " + unixLibName + ", " + macOSXLibName + ")");
+ System.err.println("NativeLibrary.open(global "+global+"): Did not succeed in loading (" + windowsLibName + ", " + unixLibName + ", " + macOSXLibName + ")");
}
// For now, just return null to indicate the open operation didn't