aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/os
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-03 11:56:40 +0200
committerSven Gothel <[email protected]>2011-08-03 11:56:40 +0200
commite659f5994875275d4eb46e745676a3d84e27d1e9 (patch)
treeaa8bd6bdcb2a02f1c8fc0b2f89aba0aac6160229 /src/java/com/jogamp/common/os
parentd30d6548baa4fa18c55eb4f9087bca5700463a51 (diff)
Hide DynamicLinker impl.; Remove public AndroidPackageUtil ; GluegenVersionActivity uses ApplicationContext
Hide DynamicLinker impl.: - com.jogamp.common.os.*DynamicLinkerImpl -> jogamp.common.os
Diffstat (limited to 'src/java/com/jogamp/common/os')
-rwxr-xr-xsrc/java/com/jogamp/common/os/DynamicLinker.java2
-rwxr-xr-xsrc/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java64
-rwxr-xr-xsrc/java/com/jogamp/common/os/NativeLibrary.java4
-rwxr-xr-xsrc/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java63
-rwxr-xr-xsrc/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java77
5 files changed, 5 insertions, 205 deletions
diff --git a/src/java/com/jogamp/common/os/DynamicLinker.java b/src/java/com/jogamp/common/os/DynamicLinker.java
index d67a38f..924a776 100755
--- a/src/java/com/jogamp/common/os/DynamicLinker.java
+++ b/src/java/com/jogamp/common/os/DynamicLinker.java
@@ -42,7 +42,7 @@ package com.jogamp.common.os;
/** Provides an abstract interface to the OS's low-level dynamic
linking functionality. */
-interface DynamicLinker {
+public interface DynamicLinker {
public long openLibraryGlobal(String pathname, boolean debug);
public long openLibraryLocal(String pathname, boolean debug);
public long lookupSymbol(long libraryHandle, String symbolName);
diff --git a/src/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java b/src/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java
deleted file mode 100755
index 0e71d5d..0000000
--- a/src/java/com/jogamp/common/os/MacOSXDynamicLinkerImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:27:00 PDT 2006 ----! */
-
-package com.jogamp.common.os;
-
-
-public class MacOSXDynamicLinkerImpl implements DynamicLinker {
-
- public static final long RTLD_DEFAULT = -2;
-
- public static final int RTLD_LAZY = 0x1;
- public static final int RTLD_NOW = 0x2;
- public static final int RTLD_LOCAL = 0x4;
- public static final int RTLD_GLOBAL = 0x8;
-
- /** Interface to C language function: <br> <code> int dlclose(void * __handle); </code> */
- private static native int dlclose(long __handle);
-
- /** 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 * __path, int __mode); </code> */
- private static native long dlopen(java.lang.String __path, int __mode);
-
- /** Interface to C language function: <br> <code> void * dlsym(void * __handle, const char * __symbol); </code> */
- private static native long dlsym(long __handle, java.lang.String __symbol);
-
-
- // --- Begin CustomJavaCode .cfg declarations
- public long openLibraryLocal(String pathname, boolean debug) {
- // Note we use RTLD_LOCAL 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 long lookupSymbolGlobal(String symbolName) {
- return dlsym(RTLD_DEFAULT, symbolName);
- }
-
- public void closeLibrary(long libraryHandle) {
- dlclose(libraryHandle);
- }
- // ---- End CustomJavaCode .cfg declarations
-
-} // end of class MacOSXDynamicLinkerImpl
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java
index 47c73e6..1df0e61 100755
--- a/src/java/com/jogamp/common/os/NativeLibrary.java
+++ b/src/java/com/jogamp/common/os/NativeLibrary.java
@@ -41,6 +41,10 @@ package com.jogamp.common.os;
import com.jogamp.gluegen.runtime.NativeLibLoader;
import jogamp.common.Debug;
+import jogamp.common.os.MacOSXDynamicLinkerImpl;
+import jogamp.common.os.UnixDynamicLinkerImpl;
+import jogamp.common.os.WindowsDynamicLinkerImpl;
+
import java.io.*;
import java.lang.reflect.*;
import java.security.*;
diff --git a/src/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java
deleted file mode 100755
index fcfe418..0000000
--- a/src/java/com/jogamp/common/os/UnixDynamicLinkerImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */
-
-package com.jogamp.common.os;
-
-
-public class UnixDynamicLinkerImpl implements DynamicLinker {
-
- public static final long RTLD_DEFAULT = 0;
- public static final int RTLD_LAZY = 0x00001;
- public static final int RTLD_NOW = 0x00002;
- public static final int RTLD_GLOBAL = 0x00100;
- public static final int RTLD_LOCAL = 0x00000;
-
- /** 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 long lookupSymbolGlobal(String symbolName) {
- return dlsym(RTLD_DEFAULT, symbolName);
- }
-
- public void closeLibrary(long libraryHandle) {
- dlclose(libraryHandle);
- }
- // ---- End CustomJavaCode .cfg declarations
-
-} // end of class UnixDynamicLinkerImpl
diff --git a/src/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java b/src/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java
deleted file mode 100755
index 7bbfe23..0000000
--- a/src/java/com/jogamp/common/os/WindowsDynamicLinkerImpl.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Tue May 27 02:37:55 PDT 2008 ----! */
-
-package com.jogamp.common.os;
-
-import java.security.*;
-
-public class WindowsDynamicLinkerImpl implements DynamicLinker {
-
- private static boolean DEBUG;
-
- static {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- DEBUG = (System.getProperty("jogamp.debug.NativeLibrary") != null);
- return null;
- }
- });
- }
-
- /** Interface to C language function: <br> <code> BOOL FreeLibrary(HANDLE hLibModule); </code> */
- private static native int FreeLibrary(long hLibModule);
-
- /** Interface to C language function: <br> <code> DWORD GetLastError(void); </code> */
- private static native int GetLastError();
-
- /** Interface to C language function: <br> <code> PROC GetProcAddressA(HANDLE hModule, LPCSTR lpProcName); </code> */
- private static native long GetProcAddressA(long hModule, java.lang.String lpProcName);
-
- /** Interface to C language function: <br> <code> HANDLE LoadLibraryW(LPCWSTR lpLibFileName); </code> */
- private static native long LoadLibraryW(java.lang.String lpLibFileName);
-
-
- // --- Begin CustomJavaCode .cfg declarations
- public long openLibraryLocal(String libraryName, boolean debug) {
- // How does that work under Windows ?
- // Don't know .. so it's an alias for the time being
- return openLibraryGlobal(libraryName, debug);
- }
-
- public long openLibraryGlobal(String libraryName, boolean debug) {
- long handle = LoadLibraryW(libraryName);
- if(0==handle && debug) {
- int err = GetLastError();
- System.err.println("LoadLibraryW \""+libraryName+"\" failed, error code: 0x"+Integer.toHexString(err)+", "+err);
- }
- return handle;
- }
-
- public long lookupSymbol(long libraryHandle, String symbolName) {
- String _symbolName = symbolName;
- long addr = GetProcAddressA(libraryHandle, _symbolName);
- if(0==addr) {
- // __stdcall hack: try some @nn decorations,
- // the leading '_' must not be added (same with cdecl)
- final int argAlignment=4; // 4 byte alignment of each argument
- final int maxArguments=12; // experience ..
- for(int arg=0; 0==addr && arg<=maxArguments; arg++) {
- _symbolName = symbolName+"@"+(arg*argAlignment);
- addr = GetProcAddressA(libraryHandle, _symbolName);
- }
- }
- if(DEBUG) {
- System.err.println("WindowsDynamicLinkerImpl.lookupSymbol(0x"+Long.toHexString(libraryHandle)+", "+symbolName+") -> "+_symbolName+", 0x"+Long.toHexString(addr));
- }
- return addr;
- }
-
- public long lookupSymbolGlobal(String symbolName) {
- throw new RuntimeException("lookupSymbolGlobal: Not supported on Windows");
- }
-
- public void closeLibrary(long libraryHandle) {
- FreeLibrary(libraryHandle);
- }
- // ---- End CustomJavaCode .cfg declarations
-
-} // end of class WindowsDynamicLinkerImpl