From c91f003551542c2aab62dd8ef89a7894c7e50689 Mon Sep 17 00:00:00 2001
From: Kenneth Russel <kbrussel@alum.mit.edu>
Date: Mon, 15 Jun 2009 22:42:48 +0000
Subject: Copied JOGL_2_SANDBOX r145 on to trunk; JOGL_2_SANDBOX branch is now
 closed

git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@147 a78bb65f-1512-4460-ba86-f6dc96a7bf27
---
 make/dynlink-unix-CustomJavaCode.java | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100755 make/dynlink-unix-CustomJavaCode.java

(limited to 'make/dynlink-unix-CustomJavaCode.java')

diff --git a/make/dynlink-unix-CustomJavaCode.java b/make/dynlink-unix-CustomJavaCode.java
new file mode 100755
index 0000000..5d10edf
--- /dev/null
+++ b/make/dynlink-unix-CustomJavaCode.java
@@ -0,0 +1,18 @@
+public long openLibrary(String pathname) {
+  // 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
+  // looked up dynamically via the ProcAddressTable mechanism; in
+  // other words, one can actually link against the library instead of
+  // having to dlsym all entry points. System.loadLibrary() uses
+  // RTLD_LOCAL visibility so can't be used for this purpose.
+  return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL);
+}
+
+public long lookupSymbol(long libraryHandle, String symbolName) {
+  return dlsym(libraryHandle, symbolName);
+}
+
+public void closeLibrary(long libraryHandle) {
+  dlclose(libraryHandle);
+}
-- 
cgit v1.2.3