diff options
Diffstat (limited to 'src/native')
-rw-r--r-- | src/native/unix/UnixDynamicLinkerImpl_JNI.c | 29 | ||||
-rw-r--r-- | src/native/windows/WindowsDynamicLinkerImpl_JNI.c | 16 |
2 files changed, 42 insertions, 3 deletions
diff --git a/src/native/unix/UnixDynamicLinkerImpl_JNI.c b/src/native/unix/UnixDynamicLinkerImpl_JNI.c index d818b3e..844002f 100644 --- a/src/native/unix/UnixDynamicLinkerImpl_JNI.c +++ b/src/native/unix/UnixDynamicLinkerImpl_JNI.c @@ -1,14 +1,22 @@ /* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */ +#if defined(_WIN32) + // NOP +#elif defined(__linux__) + #define _GNU_SOURCE +#else + // NOP +#endif + +#include <dlfcn.h> +#include <inttypes.h> + #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 @@ -127,3 +135,18 @@ Java_jogamp_common_os_UnixDynamicLinkerImpl_dlsym(JNIEnv *env, jclass _unused, j return (jlong) (intptr_t) _res; } +/* + * Class: jogamp_common_os_UnixDynamicLinkerImpl + * Method: dladdr_fname + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_jogamp_common_os_UnixDynamicLinkerImpl_dladdr_1fname(JNIEnv *env, jclass _unused, jlong arg0) { + Dl_info info; + if( 0 != dladdr((void *) (intptr_t) arg0, &info) && NULL != info.dli_fname ) { + return (*env)->NewStringUTF(env, info.dli_fname); + } else { + return NULL; + } +} + diff --git a/src/native/windows/WindowsDynamicLinkerImpl_JNI.c b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c index ef94bb0..1874b30 100644 --- a/src/native/windows/WindowsDynamicLinkerImpl_JNI.c +++ b/src/native/windows/WindowsDynamicLinkerImpl_JNI.c @@ -94,4 +94,20 @@ Java_jogamp_common_os_WindowsDynamicLinkerImpl_LoadLibraryW(JNIEnv *env, jclass return (jlong) (intptr_t) _res; } +/* + * Class: jogamp_common_os_WindowsDynamicLinkerImpl + * Method: GetModuleFileNameA + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_jogamp_common_os_WindowsDynamicLinkerImpl_GetModuleFileNameA(JNIEnv *env, jclass _unused, jlong hModule) { + TCHAR tpath[PATH_MAX+1]; + memset(tpath, 0, PATH_MAX+1); + DWORD size = GetModuleFileNameA((HANDLE) (intptr_t) hModule, (LPTSTR)&tpath, PATH_MAX); + if( 0 == size ) { + return NULL; + } + return (*env)->NewStringUTF(env, tpath); +} + |