Mac OS X: Added loading of a legacy native lwjgl library to support applications that need to run on Mac OS X 10.2, 10.3 and 10.4, including intel mac versions. NOTE: Intel support from the universal build is not tested, since I don\'t have acces to an intel mac.

This commit is contained in:
Elias Naur 2006-01-16 20:37:28 +00:00
parent 8f7540ce43
commit e1c51385c6
6 changed files with 88 additions and 27 deletions

View file

@ -54,20 +54,31 @@ public final class Sys {
/** Current version of library */
private static final String VERSION = "0.99";
/** The native library name */
private static final String LIBRARY_NAME = "lwjgl";
/** The implementation instance to delegate platform specific behavior to */
private final static SysImplementation implementation;
static {
implementation = createImplementation();
private static void loadLibrary(final String name) {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
System.loadLibrary(LIBRARY_NAME);
System.loadLibrary(name);
return null;
}
});
}
static {
implementation = createImplementation();
String[] library_names = implementation.getNativeLibraryNames();
UnsatisfiedLinkError last_load_error = null;
for (int i = 0; i < library_names.length; i++) {
try {
loadLibrary(library_names[i]);
} catch (UnsatisfiedLinkError e) {
last_load_error = e;
}
}
if (last_load_error != null)
throw last_load_error;
String native_version = implementation.getNativeLibraryVersion();
if (!native_version.equals(getVersion()))
throw new LinkageError("Version mismatch: jar version is '" + getVersion() +