1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */
#include <jni.h>
#include <assert.h>
#include "jogamp_common_os_UnixDynamicLinkerImpl.h"
#include <dlfcn.h>
#include <inttypes.h>
#ifndef RTLD_DEFAULT
#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 * );
*/
JNIEXPORT jint JNICALL
Java_jogamp_common_os_UnixDynamicLinkerImpl_dlclose__J(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);
*/
JNIEXPORT jstring JNICALL
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);
*/
JNIEXPORT jlong JNICALL
Java_jogamp_common_os_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(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");
#endif
if (arg0 != NULL) {
if (arg0 != NULL) {
_UTF8arg0 = (*env)->GetStringUTFChars(env, arg0, (jboolean*)NULL);
if (_UTF8arg0 == NULL) {
(*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"),
"Failed to get UTF-8 chars for argument \"arg0\" in native dispatcher for \"dlopen\"");
return 0;
}
}
}
#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);
_res = dlopen((char *) _UTF8arg0, (int) arg1);
fprintf(stderr, "XXX dlopen.2: %p\n", _res); fflush(stderr);
#else
_res = dlopen((char *) _UTF8arg0, (int) arg1);
#endif
if (arg0 != NULL) {
(*env)->ReleaseStringUTFChars(env, arg0, _UTF8arg0);
}
#ifdef DEBUG_DLOPEN
fprintf(stderr, "XXX dlopen.X\n"); fflush(stderr);
#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 * );
*/
JNIEXPORT jlong JNICALL
Java_jogamp_common_os_UnixDynamicLinkerImpl_dlsym__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong arg0, jstring arg1) {
const char* _UTF8arg1 = NULL;
void * _res;
if (arg1 != NULL) {
if (arg1 != NULL) {
_UTF8arg1 = (*env)->GetStringUTFChars(env, arg1, (jboolean*)NULL);
if (_UTF8arg1 == NULL) {
(*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"),
"Failed to get UTF-8 chars for argument \"arg1\" in native dispatcher for \"dlsym\"");
return 0;
}
}
}
_res = dlsym((void *) (intptr_t) arg0, (char *) _UTF8arg1);
if (arg1 != NULL) {
(*env)->ReleaseStringUTFChars(env, arg1, _UTF8arg1);
}
return (jlong) (intptr_t) _res;
}
|