summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-06-15 22:42:48 +0000
committerKenneth Russel <[email protected]>2009-06-15 22:42:48 +0000
commitc91f003551542c2aab62dd8ef89a7894c7e50689 (patch)
treee49c45b21c3ebeb8d238e8eb96415c745f9427da /src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java
parent90bcb596e88898f807b39c9e7c85485ab8c006b6 (diff)
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
Diffstat (limited to 'src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java')
-rwxr-xr-xsrc/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java
new file mode 100755
index 0000000..773d832
--- /dev/null
+++ b/src/java/com/sun/gluegen/runtime/UnixDynamicLinkerImpl.java
@@ -0,0 +1,66 @@
+/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */
+
+package com.sun.gluegen.runtime;
+
+import com.sun.gluegen.runtime.*;
+
+public class UnixDynamicLinkerImpl implements DynamicLinker
+{
+
+ public static final int RTLD_LAZY = 0x00001;
+ public static final int RTLD_NOW = 0x00002;
+ public static final int RTLD_NOLOAD = 0x00004;
+ public static final int RTLD_GLOBAL = 0x00100;
+ public static final int RTLD_LOCAL = 0x00000;
+ public static final int RTLD_PARENT = 0x00200;
+ public static final int RTLD_GROUP = 0x00400;
+ public static final int RTLD_WORLD = 0x00800;
+ public static final int RTLD_NODELETE = 0x01000;
+ public static final int RTLD_FIRST = 0x02000;
+
+ /** Interface to C language function: <br> <code> int dlclose(void * ); </code> */
+ private static native int dlclose(long arg0);
+
+ /** Interface to C language function: <br> <code> char * dlerror(void); </code> */
+ private static native java.lang.String dlerror();
+
+ /** Interface to C language function: <br> <code> void * dlopen(const char * , int); </code> */
+ private static native long dlopen(java.lang.String arg0, int arg1);
+
+ /** Interface to C language function: <br> <code> void * dlsym(void * , const char * ); </code> */
+ private static native long dlsym(long arg0, java.lang.String arg1);
+
+
+ // --- Begin CustomJavaCode .cfg declarations
+ 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
+ // 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_LOCAL);
+ }
+
+ 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
+ // 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);
+ }
+ // ---- End CustomJavaCode .cfg declarations
+
+} // end of class UnixDynamicLinkerImpl