diff options
author | Kenneth Russel <[email protected]> | 2006-08-01 23:22:54 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-08-01 23:22:54 +0000 |
commit | 5f3f32052969e8133c8fe7c50835763cedfebb43 (patch) | |
tree | 6ccd8ac7f94ee02ce16b5568d8c965b1c74c9a09 /src/native/unix | |
parent | ff5fa954165c45037849b986f41f4a192cad163e (diff) |
Added NativeLibrary helper class to com.sun.gluegen.runtime package,
principally to generally solve the problem of downloading dependent
libraries of GlueGen-generated native code, as in the case of JOAL and
OpenAL reported recently by Shawn Kendall on JOAL forums.
Autogenerated Java and native code associated with this new
NativeLibrary helper class is currently checked in to the GlueGen
workspace to make it easier to build across multiple platforms; it can
be regenerated by running the generate.nativelibrary.sources Ant
target in the GlueGen workspace. Building of the native code in the
GlueGen workspace is currently disabled by default and can be enabled
by specifying -Dbuild.native=1 on the ant command line. Use of the new
NativeLibrary class in JOAL is currently disabled by default and can
be enabled by specifying -Djoal.use.gluegen=1 to applications using
JOAL. New functionality has been lightly tested with JOAL on Windows
and appears to be working. More testing, including build and Java Web
Start deployment testing, to follow on other platforms.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@37 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/native/unix')
-rwxr-xr-x | src/native/unix/UnixDynamicLinkerImpl_JNI.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/native/unix/UnixDynamicLinkerImpl_JNI.c b/src/native/unix/UnixDynamicLinkerImpl_JNI.c new file mode 100755 index 0000000..6d72646 --- /dev/null +++ b/src/native/unix/UnixDynamicLinkerImpl_JNI.c @@ -0,0 +1,89 @@ +/* !---- 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 <dlfcn.h> + #include <inttypes.h> + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: int dlclose(long arg0) + * C function: int dlclose(void * ); + */ +JNIEXPORT jint JNICALL +Java_com_sun_gluegen_runtime_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: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: java.lang.String dlerror() + * C function: char * dlerror(void); + */ +JNIEXPORT jstring JNICALL +Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlerror__(JNIEnv *env, jclass _unused) { + char * _res; + _res = dlerror(); + if (_res == NULL) return NULL; return (*env)->NewStringUTF(env, _res); +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: long dlopen(java.lang.String arg0, int arg1) + * C function: void * dlopen(const char * , int); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_UnixDynamicLinkerImpl_dlopen__Ljava_lang_String_2I(JNIEnv *env, jclass _unused, jstring arg0, jint arg1) { + const char* _UTF8arg0 = NULL; + void * _res; + 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; + } + } + } + _res = dlopen((char *) _UTF8arg0, (int) arg1); + if (arg0 != NULL) { + (*env)->ReleaseStringUTFChars(env, arg0, _UTF8arg0); + } + return (jlong) (intptr_t) _res; +} + + +/* Java->C glue code: + * Java package: com.sun.gluegen.runtime.UnixDynamicLinkerImpl + * Java method: long dlsym(long arg0, java.lang.String arg1) + * C function: void * dlsym(void * , const char * ); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_gluegen_runtime_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; +} + + |