From fa242848af02fd52ad39f54e88e138dfa6a95e90 Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Sat, 18 Nov 2006 22:03:02 +0000 Subject: [PATCH] JNI_VERSION restructure --- src/java/org/lwjgl/devil/ILNative.java | 11 +++++++---- src/native/common/devil/extil.c | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/java/org/lwjgl/devil/ILNative.java b/src/java/org/lwjgl/devil/ILNative.java index 8b89a2e1..17ebb23e 100644 --- a/src/java/org/lwjgl/devil/ILNative.java +++ b/src/java/org/lwjgl/devil/ILNative.java @@ -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[]{ diff --git a/src/native/common/devil/extil.c b/src/native/common/devil/extil.c index fb196c36..a0edb61a 100644 --- a/src/native/common/devil/extil.c +++ b/src/native/common/devil/extil.c @@ -8,16 +8,17 @@ #include 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; } /**