aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/os/DynamicLibraryBundle.java')
-rwxr-xr-xsrc/java/com/jogamp/common/os/DynamicLibraryBundle.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
index b7e0739..c8bf30a 100755
--- a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
+++ b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java
@@ -71,6 +71,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
private HashSet<String> toolGetProcAddressFuncNameSet;
private List<String> toolGetProcAddressFuncNameList;
+ /** Instantiates and loads all {@link NativeLibrary}s incl. JNI libraries. */
public DynamicLibraryBundle(DynamicLibraryBundleInfo info) {
if(null==info) {
throw new RuntimeException("Null DynamicLibraryBundleInfo");
@@ -102,6 +103,26 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
System.err.println(" All Complete: "+isLibComplete());
}
}
+
+ /** Unload all {@link NativeLibrary}s, and remove all references. */
+ public void destroy() {
+ if(DEBUG) {
+ System.err.println(Thread.currentThread().getName()+" - DynamicLibraryBundle.destroy() START: "+info.getClass().getName());
+ }
+ toolGetProcAddressFuncNameSet = null;
+ toolGetProcAddressHandle = 0;
+ for(int i = 0; i<nativeLibraries.size(); i++) {
+ nativeLibraries.get(i).close();
+ }
+ nativeLibraries.clear();
+ nativeLibraries = null;
+ toolLibNames = null;
+ glueLibNames = null;
+ if(DEBUG) {
+ System.err.println(Thread.currentThread().getName()+" - DynamicLibraryBundle.destroy() END: "+info.getClass().getName());
+ }
+ info = null;
+ }
public final boolean isLibComplete() {
return isToolLibComplete() && isGlueLibComplete() ;
@@ -267,7 +288,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper {
}
}
}
-
+
private long dynamicLookupFunctionOnLibs(String funcName) {
if(!isToolLibLoaded() || null==funcName) {
if(DEBUG_LOOKUP && !isToolLibLoaded()) {