diff options
author | Sven Gothel <[email protected]> | 2009-06-05 03:15:12 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-06-05 03:15:12 +0000 |
commit | b1be10c6b8e7aded4883060f5f0c3ede8b869c69 (patch) | |
tree | a9eeb9af5292c892c66d268a84d5d038a71db9e7 /src/java/com/sun/gluegen | |
parent | 18dce8e4df9eb4e21c5a3d1a0085ed707c018fa6 (diff) |
Adding debug flag to native dynamic linker
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@141 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun/gluegen')
5 files changed, 18 insertions, 12 deletions
diff --git a/src/java/com/sun/gluegen/runtime/DynamicLinker.java b/src/java/com/sun/gluegen/runtime/DynamicLinker.java index c928c4c..871be04 100755 --- a/src/java/com/sun/gluegen/runtime/DynamicLinker.java +++ b/src/java/com/sun/gluegen/runtime/DynamicLinker.java @@ -43,8 +43,8 @@ package com.sun.gluegen.runtime; linking functionality. */ interface DynamicLinker { - public long openLibraryGlobal(String pathname); - public long openLibraryLocal(String pathname); + public long openLibraryGlobal(String pathname, boolean debug); + public long openLibraryLocal(String pathname, boolean debug); public long lookupSymbol(long libraryHandle, String symbolName); public void closeLibrary(long libraryHandle); } diff --git a/src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java index 7322ffa..83ebd7a 100755 --- a/src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java +++ b/src/java/com/sun/gluegen/runtime/MacOSXDynamicLinkerImpl.java @@ -26,7 +26,7 @@ public class MacOSXDynamicLinkerImpl implements DynamicLinker // --- Begin CustomJavaCode .cfg declarations - public long openLibraryLocal(String pathname) { + public long openLibraryLocal(String pathname, boolean debug) { // Note we use RTLD_LOCAL visibility to _NOT_ allow this functionality to // be used to pre-resolve dependent libraries of JNI code without // requiring that all references to symbols in those libraries be @@ -37,7 +37,7 @@ public class MacOSXDynamicLinkerImpl implements DynamicLinker return dlopen(pathname, RTLD_LAZY | RTLD_LOCAL); } - public long openLibraryGlobal(String pathname) { + public long openLibraryGlobal(String pathname, boolean debug) { // Note we use RTLD_GLOBAL visibility to allow this functionality to // be used to pre-resolve dependent libraries of JNI code without // requiring that all references to symbols in those libraries be diff --git a/src/java/com/sun/gluegen/runtime/NativeLibrary.java b/src/java/com/sun/gluegen/runtime/NativeLibrary.java index c0e8cdf..22063a5 100755 --- a/src/java/com/sun/gluegen/runtime/NativeLibrary.java +++ b/src/java/com/sun/gluegen/runtime/NativeLibrary.java @@ -179,9 +179,9 @@ public class NativeLibrary { ensureNativeLibLoaded(); long res; if(global) { - res = dynLink.openLibraryGlobal(path); + res = dynLink.openLibraryGlobal(path, DEBUG); } else { - res = dynLink.openLibraryLocal(path); + res = dynLink.openLibraryLocal(path, DEBUG); } if (res != 0) { if (DEBUG) { diff --git a/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java index a4f5667..773d832 100755 --- a/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java +++ b/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java @@ -32,7 +32,7 @@ public class UnixDynamicLinkerImpl implements DynamicLinker // --- Begin CustomJavaCode .cfg declarations - public long openLibraryLocal(String pathname) { + public long openLibraryLocal(String pathname, boolean debug) { // Note we use RTLD_GLOBAL visibility to _NOT_ allow this functionality to // be used to pre-resolve dependent libraries of JNI code without // requiring that all references to symbols in those libraries be @@ -43,7 +43,7 @@ public class UnixDynamicLinkerImpl implements DynamicLinker return dlopen(pathname, RTLD_LAZY | RTLD_LOCAL); } - public long openLibraryGlobal(String pathname) { + public long openLibraryGlobal(String pathname, boolean debug) { // Note we use RTLD_GLOBAL visibility to allow this functionality to // be used to pre-resolve dependent libraries of JNI code without // requiring that all references to symbols in those libraries be diff --git a/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java index 45cb289..325078b 100755 --- a/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java +++ b/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java @@ -22,13 +22,19 @@ public class WindowsDynamicLinkerImpl implements DynamicLinker // --- Begin CustomJavaCode .cfg declarations - public long openLibraryLocal(String libraryName) { + public long openLibraryLocal(String libraryName, boolean debug) { // How does that work under Windows ? - return LoadLibraryW(libraryName); + // Don't know .. so it's an alias for the time being + return openLibraryGlobal(libraryName, debug); } - public long openLibraryGlobal(String libraryName) { - return LoadLibraryW(libraryName); + public long openLibraryGlobal(String libraryName, boolean debug) { + long handle = LoadLibraryW(libraryName); + if(0==handle && debug) { + int err = GetLastError(); + System.err.println("LoadLibraryW \""+libraryName+"\" failed, error code: 0x"+Integer.toHexString(err)+", "+err); + } + return handle; } public long lookupSymbol(long libraryHandle, String symbolName) { |