From bd5be69aee6987754f1cbf39f61280c5c72536b3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 12 Feb 2012 06:06:59 +0100 Subject: DynamicLibraryBundle (enhancement) - Hold DEBUG, DEBUG_LOOKUP in DynamicLookupHelper - Tool complete only if named tool's GetProcAddressFunc is avail - Allow no tool/glue lib's - Use DEBUG_LOCKUP for lockup symbol trace --- .../com/jogamp/common/os/DynamicLibraryBundle.java | 48 ++++++++++------------ 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'src/java/com/jogamp/common/os/DynamicLibraryBundle.java') diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java index c8bf30a..8a71123 100755 --- a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java +++ b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java @@ -53,9 +53,6 @@ import com.jogamp.common.jvm.JNILibLoaderBase; * */ public class DynamicLibraryBundle implements DynamicLookupHelper { - protected static final boolean DEBUG = NativeLibrary.DEBUG; - protected static final boolean DEBUG_LOOKUP = NativeLibrary.DEBUG_LOOKUP; - private DynamicLibraryBundleInfo info; private List> toolLibNames; @@ -68,6 +65,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { private int glueLibLoadedNumber; private long toolGetProcAddressHandle; + private boolean toolGetProcAddressComplete; private HashSet toolGetProcAddressFuncNameSet; private List toolGetProcAddressFuncNameList; @@ -86,16 +84,18 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { glueLibNames = info.getGlueLibNames(); loadLibraries(); toolGetProcAddressFuncNameList = info.getToolGetProcAddressFuncNameList(); - if(null!=toolGetProcAddressFuncNameList) { + if( null != toolGetProcAddressFuncNameList ) { toolGetProcAddressFuncNameSet = new HashSet(toolGetProcAddressFuncNameList); toolGetProcAddressHandle = getToolGetProcAddressHandle(); + toolGetProcAddressComplete = 0 != toolGetProcAddressHandle; } else { toolGetProcAddressFuncNameSet = new HashSet(); toolGetProcAddressHandle = 0; + toolGetProcAddressComplete = true; } if(DEBUG) { System.err.println("DynamicLibraryBundle.init Summary: "+info.getClass().getName()); - System.err.println(" toolGetProcAddressFuncNameList: "+toolGetProcAddressFuncNameList); + System.err.println(" toolGetProcAddressFuncNameList: "+toolGetProcAddressFuncNameList+", complete: "+toolGetProcAddressComplete+", 0x"+Long.toHexString(toolGetProcAddressHandle)); System.err.println(" Tool Lib Names : "+toolLibNames); System.err.println(" Tool Lib Loaded: "+getToolLibLoadedNumber()+"/"+getToolLibNumber()+" "+Arrays.toString(toolLibLoaded)+", complete "+isToolLibComplete()); System.err.println(" Glue Lib Names : "+glueLibNames); @@ -111,6 +111,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { } toolGetProcAddressFuncNameSet = null; toolGetProcAddressHandle = 0; + toolGetProcAddressComplete = false; for(int i = 0; i=0; i--) { toolLibLoaded[i] = false; } - glueLibLoaded = new boolean[glueLibNames.size()]; - for(i=0; i=0; i--) { glueLibLoaded[i] = false; } + + if(DEBUG) { + if( toolLibNames.size() == 0 ) { + System.err.println("No Tool native library names given"); + } + + if( glueLibNames.size() == 0 ) { + System.err.println("No Glue native library names given"); + } + } + toolLibLoadedNumber = 0; ClassLoader loader = getClass().getClassLoader(); NativeLibrary lib = null; @@ -258,7 +254,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { } } } - if( !isToolLibLoaded() ) { + if( toolLibNames.size() > 0 && !isToolLibLoaded() ) { if(DEBUG) { System.err.println("No Tool libraries loaded"); } -- cgit v1.2.3