aboutsummaryrefslogtreecommitdiffstats
path: root/src/native
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 /src/native
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 'src/native')
-rw-r--r--src/native/eaxfactory.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/native/eaxfactory.c b/src/native/eaxfactory.c
index d0e3e9d..6ad89ce 100644
--- a/src/native/eaxfactory.c
+++ b/src/native/eaxfactory.c
@@ -37,8 +37,12 @@
#include "eax.h"
#ifdef _WIN32
-EAXSet eaxSet; // EAXSet function, ret$
-EAXGet eaxGet; // EAXGet function, ret$
+#include <windows.h>
+static HMODULE oalModule = NULL;
+static LPALISEXTENSIONPRESENT _ptr_alIsExtensionPresent = NULL;
+static LPALGETPROCADDRESS _ptr_alGetProcAddress = NULL;
+EAXSet eaxSet; // EAXSet function
+EAXGet eaxGet; // EAXGet function
#endif
/*
@@ -48,9 +52,20 @@ EAXGet eaxGet; // EAXGet function, ret$
JNIEXPORT void JNICALL Java_net_java_games_joal_eax_EAXFactory_init
(JNIEnv *env, jclass clazz) {
#ifdef _WIN32
- if(alIsExtensionPresent("EAX2.0")) {
- eaxSet = alGetProcAddress((ALubyte*)"EAXSet");
- eaxGet = alGetProcAddress((ALubyte*)"EAXGet");
- }
+ if (_ptr_alIsExtensionPresent == NULL) {
+ if (oalModule == NULL) {
+ oalModule = GetModuleHandle("OpenAL32");
+ }
+ _ptr_alIsExtensionPresent = (LPALISEXTENSIONPRESENT) GetProcAddress(oalModule, "alIsExtensionPresent");
+ _ptr_alGetProcAddress = (LPALGETPROCADDRESS) GetProcAddress(oalModule, "alGetProcAddress");
+ }
+
+ if (_ptr_alIsExtensionPresent != NULL &&
+ _ptr_alGetProcAddress != NULL) {
+ if ((*_ptr_alIsExtensionPresent)("EAX2.0")) {
+ eaxSet = (*_ptr_alGetProcAddress)((ALubyte*)"EAXSet");
+ eaxGet = (*_ptr_alGetProcAddress)((ALubyte*)"EAXGet");
+ }
+ }
#endif
}