summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-01-30 20:46:29 +0100
committerSven Gothel <[email protected]>2015-01-30 20:46:29 +0100
commit6eba192bec7cc6258fbc0c97b448fe4a4d45de9a (patch)
tree4994ec56ff220b3499f82010e66b0357b88f1a58
parent30933c60156c67a9624fefae2be6504300ce71bb (diff)
GlueGen: Cleanup static generated JNI code (fix method names)
Symbol could not be found w/ Android: UnixDynamicLinkerImpl_JNI.c::Java_jogamp_common_os_UnixDynamicLinkerImpl_dlerror
-rw-r--r--src/native/common/JVMUtil.c5
-rw-r--r--src/native/unix/UnixDynamicLinkerImpl_JNI.c78
-rw-r--r--src/native/windows/WindowsDynamicLinkerImpl_JNI.c8
3 files changed, 55 insertions, 36 deletions
diff --git a/src/native/common/JVMUtil.c b/src/native/common/JVMUtil.c
index 6df2aff..e9b399f 100644
--- a/src/native/common/JVMUtil.c
+++ b/src/native/common/JVMUtil.c
@@ -43,6 +43,11 @@
#include "jogamp_common_jvm_JVMUtil.h"
+/*
+ * Class: jogamp_common_jvm_JVMUtil
+ * Method: initialize
+ * Signature: (Ljava/nio/ByteBuffer;)Z
+ */
JNIEXPORT jboolean JNICALL
Java_jogamp_common_jvm_JVMUtil_initialize(JNIEnv *env, jclass _unused, jobject nioBuffer) {
void * ptr = NULL;
diff --git a/src/native/unix/UnixDynamicLinkerImpl_JNI.c b/src/native/unix/UnixDynamicLinkerImpl_JNI.c
index c23c9ef..d818b3e 100644
--- a/src/native/unix/UnixDynamicLinkerImpl_JNI.c
+++ b/src/native/unix/UnixDynamicLinkerImpl_JNI.c
@@ -13,49 +13,63 @@
#define RTLD_DEFAULT ((void *) 0)
#endif
-/* Java->C glue code:
- * Java package: jogamp.common.os.UnixDynamicLinkerImpl
- * Java method: int dlclose(long arg0)
- * C function: int dlclose(void * );
+// #define DEBUG_DLOPEN 1
+
+#ifdef DEBUG_DLOPEN
+ typedef void *(*DLOPEN_FPTR_TYPE)(const char *filename, int flag);
+ #define VERBOSE_ON 1
+#endif
+
+// #define VERBOSE_ON 1
+
+#ifdef VERBOSE_ON
+ #ifdef ANDROID
+ #include <android/log.h>
+ #define DBG_PRINT(...) __android_log_print(ANDROID_LOG_DEBUG, "JogAmp", __VA_ARGS__)
+ #else
+ #define DBG_PRINT(...) fprintf(stderr, __VA_ARGS__); fflush(stderr)
+ #endif
+#else
+ #define DBG_PRINT(...)
+#endif
+
+/*
+ * Class: jogamp_common_os_UnixDynamicLinkerImpl
+ * Method: dlclose
+ * Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_jogamp_common_os_UnixDynamicLinkerImpl_dlclose__J(JNIEnv *env, jclass _unused, jlong arg0) {
+Java_jogamp_common_os_UnixDynamicLinkerImpl_dlclose(JNIEnv *env, jclass _unused, jlong arg0) {
int _res;
_res = dlclose((void *) (intptr_t) arg0);
return _res;
}
-/* Java->C glue code:
- * Java package: jogamp.common.os.UnixDynamicLinkerImpl
- * Java method: java.lang.String dlerror()
- * C function: char * dlerror(void);
+/*
+ * Class: jogamp_common_os_UnixDynamicLinkerImpl
+ * Method: dlerror
+ * Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_jogamp_common_os_UnixDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) {
+Java_jogamp_common_os_UnixDynamicLinkerImpl_dlerror(JNIEnv *env, jclass _unused) {
char * _res;
_res = dlerror();
if (_res == NULL) return NULL; return (*env)->NewStringUTF(env, _res);
}
-// #define DEBUG_DLOPEN 1
-
-#ifdef DEBUG_DLOPEN
- typedef void *(*DLOPEN_FPTR_TYPE)(const char *filename, int flag);
-#endif
-
-/* Java->C glue code:
- * Java package: jogamp.common.os.UnixDynamicLinkerImpl
- * Java method: long dlopen(java.lang.String arg0, int arg1)
- * C function: void * dlopen(const char * , int);
+/*
+ * Class: jogamp_common_os_UnixDynamicLinkerImpl
+ * Method: dlopen
+ * Signature: (Ljava/lang/String;I)J
*/
JNIEXPORT jlong JNICALL
-Java_jogamp_common_os_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring arg0, jint arg1) {
+Java_jogamp_common_os_UnixDynamicLinkerImpl_dlopen(JNIEnv *env, jclass _unused, jstring arg0, jint arg1) {
const char* _UTF8arg0 = NULL;
void * _res;
#ifdef DEBUG_DLOPEN
DLOPEN_FPTR_TYPE dlopenFunc = NULL;
- fprintf(stderr, "XXX dlopen.0\n");
+ DBG_PRINT("XXX dlopen.0\n");
#endif
if (arg0 != NULL) {
@@ -70,9 +84,9 @@ Java_jogamp_common_os_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv
}
#ifdef DEBUG_DLOPEN
dlopenFunc = (DLOPEN_FPTR_TYPE) dlsym(RTLD_DEFAULT, "dlopen");
- fprintf(stderr, "XXX dlopen.1: lib %s, dlopen-fptr %p %p (%d)\n", _UTF8arg0, dlopen, dlopenFunc, dlopen==dlopenFunc); fflush(stderr);
+ DBG_PRINT("XXX dlopen.1: lib %s, dlopen-fptr %p %p (%d)\n", _UTF8arg0, dlopen, dlopenFunc, dlopen==dlopenFunc);
_res = dlopen((char *) _UTF8arg0, (int) arg1);
- fprintf(stderr, "XXX dlopen.2: %p\n", _res); fflush(stderr);
+ DBG_PRINT("XXX dlopen.2: %p\n", _res);
#else
_res = dlopen((char *) _UTF8arg0, (int) arg1);
#endif
@@ -80,19 +94,18 @@ Java_jogamp_common_os_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv
(*env)->ReleaseStringUTFChars(env, arg0, _UTF8arg0);
}
#ifdef DEBUG_DLOPEN
- fprintf(stderr, "XXX dlopen.X\n"); fflush(stderr);
+ DBG_PRINT("XXX dlopen.X\n");
#endif
return (jlong) (intptr_t) _res;
}
-
-/* Java->C glue code:
- * Java package: jogamp.common.os.UnixDynamicLinkerImpl
- * Java method: long dlsym(long arg0, java.lang.String arg1)
- * C function: void * dlsym(void * , const char * );
+/*
+ * Class: jogamp_common_os_UnixDynamicLinkerImpl
+ * Method: dlsym
+ * Signature: (JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_jogamp_common_os_UnixDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong arg0, jstring arg1) {
+Java_jogamp_common_os_UnixDynamicLinkerImpl_dlsym(JNIEnv *env, jclass _unused, jlong arg0, jstring arg1) {
const char* _UTF8arg1 = NULL;
void * _res;
if (arg1 != NULL) {
@@ -106,10 +119,11 @@ Java_jogamp_common_os_UnixDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *
}
}
_res = dlsym((void *) (intptr_t) arg0, (char *) _UTF8arg1);
+ DBG_PRINT("XXX dlsym: handle %p, symbol %s -> %p\n", (void *) (intptr_t) arg0, _UTF8arg1, _res);
+
if (arg1 != NULL) {
(*env)->ReleaseStringUTFChars(env, arg1, _UTF8arg1);
}
return (jlong) (intptr_t) _res;
}
-
diff --git a/src/native/windows/WindowsDynamicLinkerImpl_JNI.c b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c
index 9ddb9d0..ef94bb0 100644
--- a/src/native/windows/WindowsDynamicLinkerImpl_JNI.c
+++ b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c
@@ -24,7 +24,7 @@
* C function: BOOL FreeLibrary(HANDLE hLibModule);
*/
JNIEXPORT jint JNICALL
-Java_jogamp_common_os_WindowsDynamicLinkerImpl_FreeLibrary__J(JNIEnv *env, jclass _unused, jlong hLibModule) {
+Java_jogamp_common_os_WindowsDynamicLinkerImpl_FreeLibrary(JNIEnv *env, jclass _unused, jlong hLibModule) {
BOOL _res;
_res = FreeLibrary((HANDLE) (intptr_t) hLibModule);
return _res;
@@ -37,7 +37,7 @@ Java_jogamp_common_os_WindowsDynamicLinkerImpl_FreeLibrary__J(JNIEnv *env, jclas
* C function: DWORD GetLastError(void);
*/
JNIEXPORT jint JNICALL
-Java_jogamp_common_os_WindowsDynamicLinkerImpl_GetLastError__(JNIEnv *env, jclass _unused) {
+Java_jogamp_common_os_WindowsDynamicLinkerImpl_GetLastError(JNIEnv *env, jclass _unused) {
DWORD _res;
_res = GetLastError();
return _res;
@@ -50,7 +50,7 @@ Java_jogamp_common_os_WindowsDynamicLinkerImpl_GetLastError__(JNIEnv *env, jclas
* C function: PROC GetProcAddressA(HANDLE hModule, LPCSTR lpProcName);
*/
JNIEXPORT jlong JNICALL
-Java_jogamp_common_os_WindowsDynamicLinkerImpl_GetProcAddressA__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong hModule, jstring lpProcName) {
+Java_jogamp_common_os_WindowsDynamicLinkerImpl_GetProcAddressA(JNIEnv *env, jclass _unused, jlong hModule, jstring lpProcName) {
const char* _strchars_lpProcName = NULL;
PROC _res;
if (lpProcName != NULL) {
@@ -75,7 +75,7 @@ Java_jogamp_common_os_WindowsDynamicLinkerImpl_GetProcAddressA__JLjava_lang_Stri
* C function: HANDLE LoadLibraryW(LPCWSTR lpLibFileName);
*/
JNIEXPORT jlong JNICALL
-Java_jogamp_common_os_WindowsDynamicLinkerImpl_LoadLibraryW__Ljava_lang_String_2(JNIEnv *env, jclass _unused, jstring lpLibFileName) {
+Java_jogamp_common_os_WindowsDynamicLinkerImpl_LoadLibraryW(JNIEnv *env, jclass _unused, jstring lpLibFileName) {
jchar* _strchars_lpLibFileName = NULL;
HANDLE _res;
if (lpLibFileName != NULL) {