diff options
Diffstat (limited to 'src/java/com')
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) { |