JNI_VERSION restructure

This commit is contained in:
Brian Matzon 2006-11-18 22:03:02 +00:00
parent 1e806b9188
commit fa242848af
2 changed files with 11 additions and 7 deletions

View File

@ -54,6 +54,9 @@ class ILNative {
/** Version of IL */
public static final String VERSION = "1.0beta3";
/** Current version of the JNI library */
static final int JNI_VERSION = 1;
private static void loadLibrary(final String lib_name) {
AccessController.doPrivileged(new PrivilegedAction() {
@ -74,10 +77,10 @@ class ILNative {
loadLibrary(JNI_LIBRARY_NAME);
// check for mismatch
String nativeVersion = getNativeLibraryVersion();
if (!nativeVersion.equals(VERSION)) {
int nativeVersion = getNativeLibraryVersion();
if (nativeVersion != JNI_VERSION) {
throw new LinkageError(
"Version mismatch: jar version is '" + VERSION +
"Version mismatch: jar version is '" + JNI_VERSION +
"', native libary version is '" + nativeVersion + "'");
}
}
@ -88,7 +91,7 @@ class ILNative {
static native void resetNativeStubsIL(Class clazz);
static native void nCreateIL(String[] ilPaths) throws LWJGLException;
static native void nDestroyIL();
private static native String getNativeLibraryVersion();
private static native int getNativeLibraryVersion();
static void createIL() throws LWJGLException {
String[] illPaths = LWJGLUtil.getLibraryPaths(new String[]{

View File

@ -8,16 +8,17 @@
#include <libgen.h>
static void* devILhandle;
#endif
#include "org_lwjgl_devil_ILNative.h";
static const char* VERSION = "1.0beta3";
/*
* Class: org_lwjgl_devil_ILNative
* Method: getNativeLibraryVersion
* Signature: ()Ljava/lang/String;
* Signature: ()I
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_devil_ILNative_getNativeLibraryVersion(JNIEnv *env, jclass clazz) {
return NewStringNative(env, VERSION);
JNIEXPORT jint JNICALL Java_org_lwjgl_devil_ILNative_getNativeLibraryVersion(JNIEnv *env, jclass clazz) {
return org_lwjgl_devil_ILNative_JNI_VERSION;
}
/**