Mac OS X: Load the framework (builtin) version of OpenAL last, after having tried all possible locations of a private openal.dylib

This commit is contained in:
Elias Naur 2006-01-16 19:35:09 +00:00
parent a47ec6d86f
commit 19d2d219ec
3 changed files with 23 additions and 6 deletions

View File

@ -66,6 +66,14 @@ public final class AL {
* @param oalPaths Array of strings containing paths to search for OpenAL library
*/
private static native void nCreate(String oalPath) throws LWJGLException;
/**
* Native method to create AL instance from the Mac OS X 10.4 OpenAL framework.
* It is only defined in the Mac OS X native library.
*
* @param oalPaths Array of strings containing paths to search for OpenAL library
*/
private static native void nCreateDefault() throws LWJGLException;
/**
* Native method the destroy the AL
@ -108,6 +116,11 @@ public final class AL {
LWJGLUtil.log("Failed to load " + oalPaths[i] + ": " + e.getMessage());
}
}
if (!created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) {
// Try to load OpenAL from the framework instead
nCreateDefault();
created = true;
}
if (!created)
throw new LWJGLException("Could not locate OpenAL library.");

View File

@ -1,7 +1,7 @@
# Use this makefile to build for Mac OS X 10.3 and earlier
CC=gcc-3.0
LINKER=gcc-3.0
CC=gcc-3.3
LINKER=gcc-3.3
STRIP=strip
ARCHS=
SYMBOL_FILE=lwjgl.symbols

View File

@ -97,10 +97,7 @@ bool tryLoadLibrary(JNIEnv *env, jstring path) {
printfDebugJava(env, "Found OpenAL at '%s'", path_str);
}
(*env)->ReleaseStringUTFChars(env, path, path_str);
openal_bundle = tryLoadFramework(env);
if (openal_bundle != NULL)
printfDebugJava(env, "Found OpenAL Bundle");
return handleOAL != NULL || openal_bundle != NULL;
return handleOAL != NULL;
}
/**
@ -113,3 +110,10 @@ void UnLoadOpenAL() {
}
}
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreateDefault(JNIEnv *env, jclass clazz) {
openal_bundle = tryLoadFramework(env);
if (openal_bundle != NULL)
printfDebugJava(env, "Found OpenAL Bundle");
else
throwException(env, "Could not load OpenAL framework");
}