summaryrefslogtreecommitdiffstats
path: root/make/joal-CustomCCode.c
diff options
context:
space:
mode:
authorkbr <[email protected]>2006-08-27 03:52:08 +0000
committerkbr <[email protected]>2006-08-27 03:52:08 +0000
commitab1d8906991beca3829f2a26ef1e12b0e3f5ee6b (patch)
treec8a70d2cd195a9db763e2a56860c85475459a152 /make/joal-CustomCCode.c
parentbdf7b44a36265373606da7556d85dfb9c47dcfdd (diff)
Changed NativeLibrary.open() to accept boolean argument indicating
whether to search the system path first; perhaps useful if applications ship only a backup version of native libraries associated with a particular Java binding. In the case of JOAL we plan to ship a recent OpenAL implementation so we will not need to search the system path first. Changed ForceProcAddressGen directive to force call-through-function-pointer semantics for the targeted function. Changed JOAL to not link directly against the OpenAL library at all, but instead to look up all entry points using the GlueGen NativeLibrary class (instead of the custom dlsym code, now removed) in particular to solve DSO versioning problems on Linux. Updated EAX binding to work with dynamically loading OpenAL. Tested on Windows so far; more testing needed on Linux in Java Web Start scenarios. git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@269 03bf7f67-59de-4072-a415-9a990d468a3f
Diffstat (limited to 'make/joal-CustomCCode.c')
-rwxr-xr-xmake/joal-CustomCCode.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/make/joal-CustomCCode.c b/make/joal-CustomCCode.c
deleted file mode 100755
index 26c9b42..0000000
--- a/make/joal-CustomCCode.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#if defined(_MSC_VER) /* Windows */
-#include <windows.h>
-static HMODULE oalModule = NULL;
-#else
-/* Hack for Linux */
-#define __USE_GNU
-#include <dlfcn.h>
-#endif
-
-/* Java->C glue code:
- * Java package: net.java.games.joal.impl.ALImpl
- * Java method: long dynamicLookupFunction0(java.lang.String fname)
- * C function: ALproc alGetProcAddress(const ALchar * fname);
- */
-JNIEXPORT jlong JNICALL
-Java_net_java_games_joal_impl_ALImpl_dynamicLookupFunction0__Ljava_lang_String_2(JNIEnv *env, jobject _unused, jstring fname) {
- const char* _UTF8fname = NULL;
- ALproc _res;
- if (fname != NULL) {
- if (fname != NULL) {
- _UTF8fname = (*env)->GetStringUTFChars(env, fname, (jboolean*)NULL);
- if (_UTF8fname == NULL) {
- (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"),
- "Failed to get UTF-8 chars for argument \"fname\" in native dispatcher for \"alGetProcAddress\"");
- return 0;
- }
- }
- }
-#if defined(_MSC_VER) /* Windows */
- if (oalModule == NULL) {
- oalModule = GetModuleHandle("OpenAL32");
- }
- _res = (ALproc) GetProcAddress(oalModule, _UTF8fname);
-/* Looks like we can use dlsym on OS X as well as other Unix flavors */
-/* #elif defined(__APPLE__) && defined(__MACH__) */ /* OS X */
-#else /* Assume vanilla Unix */
- _res = (ALproc) dlsym(RTLD_DEFAULT, _UTF8fname);
-#endif
-
- if (fname != NULL) {
- (*env)->ReleaseStringUTFChars(env, fname, _UTF8fname);
- }
- return (jlong) (intptr_t) _res;
-}