aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-11-26 09:49:12 +0100
committerSven Gothel <[email protected]>2023-11-26 09:49:12 +0100
commitc7efca6d9b0db7305f5352ebf15d915ae5a1fa24 (patch)
tree7ba72733c9296aea5ea339b3fd81d264b49d3e8c /src/junit/com
parentaea14464d521dca28165498ffe943ef1122fc2e3 (diff)
Bug 1479: NativeLibrary: Add getNativeLibraryPath() returning queried used native library path, supported throughout DynamicLibraryBundle[Info]
Motivation: It is helpful to retrieve the actually used native library pathname, since loading a library w/o absolute path but lookup through LD_LIBRARY_PATH may render it hard for the user to determine which library is used. +++ +++ Windows implementation simply can use GetModuleFileNameA() with the native library handle. POSIX implementation may utilize a symbol-name to retrieve its address within the loading native library used to retrieved the library information via dladdr(). To support this feature throughout DynamicLibraryBundle and DynamicLibraryBundleInfo, the custom DynamicLibraryBundleInfo specializations shall provide optional symbol-names per each tool-library-name for the POSIX implementation, see above. public interface DynamicLibraryBundleInfo { ... /** * Returns optional list of optional symbol names per {@link #getToolLibNames()} * in same order for an OS which requires the symbol's address to retrieve * the path of the containing library. */ public List<String> getSymbolForToolLibPath(); ... }
Diffstat (limited to 'src/junit/com')
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java5
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java3
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java3
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java3
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java3
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java3
6 files changed, 15 insertions, 5 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java
index e4adce1..fbf0ff0 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2DynamicLibraryBundle.java
@@ -37,6 +37,7 @@ import com.jogamp.common.util.RunnableExecutor;
import com.jogamp.common.util.TestIOUtil01;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.junit.AfterClass;
@@ -58,6 +59,7 @@ public class Test1p2DynamicLibraryBundle extends BaseClass {
public static void chapter__TestLoadLibrary() throws Exception {
dlb = new DynamicLibraryBundle(new Test1DynLibBundleInfo());
Assert.assertTrue("DynamicLibraryBundle failed", dlb.isLibComplete());
+ System.err.println("Loaded: "+dlb.getToolLibraries());
Bindingtest1p2Impl.resetProcAddressTable(dlb);
}
@@ -262,6 +264,9 @@ public class Test1p2DynamicLibraryBundle extends BaseClass {
}
@Override
+ public List<String> getSymbolForToolLibPath() { return Arrays.asList("testXID"); }
+
+ @Override
public final List<String> getToolGetProcAddressFuncNameList() {
return null;
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java
index e61c600..4791002 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java
@@ -48,8 +48,9 @@ public class Test1p2LoadJNIAndImplLib extends BaseClass {
@BeforeClass
public static void chapter__TestLoadLibrary() throws Exception {
BindingJNILibLoader.loadBindingtest1p2();
- dynamicLookupHelper = NativeLibrary.open("test1", true, true, Test1p2LoadJNIAndImplLib.class.getClassLoader(), true);
+ dynamicLookupHelper = NativeLibrary.open("test1", true, true, Test1p2LoadJNIAndImplLib.class.getClassLoader(), true, "testXID");
Assert.assertNotNull("NativeLibrary.open(test1) failed", dynamicLookupHelper);
+ System.err.println("Loaded: "+dynamicLookupHelper);
Bindingtest1p2Impl.resetProcAddressTable(dynamicLookupHelper);
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
index 366d9eb..b2c1974 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
@@ -57,8 +57,9 @@ public class Test1p2ProcAddressEmitter extends BaseClass {
@BeforeClass
public static void chapter__TestLoadLibrary() throws Exception {
BindingJNILibLoader.loadBindingtest1p2();
- dynamicLookupHelper = NativeLibrary.open("test1", false, false, Test1p2ProcAddressEmitter.class.getClassLoader(), true);
+ dynamicLookupHelper = NativeLibrary.open("test1", false, false, Test1p2ProcAddressEmitter.class.getClassLoader(), true, "testXID");
Assert.assertNotNull("NativeLibrary.open(test1) failed", dynamicLookupHelper);
+ System.err.println("Loaded: "+dynamicLookupHelper);
Bindingtest1p2Impl.resetProcAddressTable(dynamicLookupHelper);
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java
index 05ae826..4e75fd0 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java
@@ -49,8 +49,9 @@ public class Test2p2FuncPtr extends BaseClass2FuncPtr {
@BeforeClass
public static void chapter__TestLoadLibrary() throws Exception {
BindingJNILibLoader.loadBindingtest2p2();
- dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test2p2FuncPtr.class.getClassLoader(), true);
+ dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test2p2FuncPtr.class.getClassLoader(), true, "textXID");
Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper);
+ System.err.println("Loaded: "+dynamicLookupHelper);
Bindingtest2p2Impl.resetProcAddressTable(dynamicLookupHelper);
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java
index 642e1bd..2c77c1b 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java
@@ -49,8 +49,9 @@ public class Test3p2PtrStorage extends BaseClass3PtrStorage {
@BeforeClass
public static void chapter__TestLoadLibrary() throws Exception {
BindingJNILibLoader.loadBindingtest2p2();
- dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test3p2PtrStorage.class.getClassLoader(), true);
+ dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test3p2PtrStorage.class.getClassLoader(), true, "textXID");
Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper);
+ System.err.println("Loaded: "+dynamicLookupHelper);
Bindingtest2p2Impl.resetProcAddressTable(dynamicLookupHelper);
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java
index 7dd9a79..0b0588d 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java
@@ -49,8 +49,9 @@ public class Test4p2JavaCallback extends BaseClass4JavaCallback {
@BeforeClass
public static void chapter__TestLoadLibrary() throws Exception {
BindingJNILibLoader.loadBindingtest2p2();
- dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test4p2JavaCallback.class.getClassLoader(), true);
+ dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test4p2JavaCallback.class.getClassLoader(), true, "textXID");
Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper);
+ System.err.println("Loaded: "+dynamicLookupHelper);
Bindingtest2p2Impl.resetProcAddressTable(dynamicLookupHelper);
}