Patch: jni.h -vs- C
Tom Tromey
tromey@cygnus.com
Thu Feb 10 15:42:00 GMT 2000
There were a couple bugs in jni.h when it was used from C -- some old,
some new. This patch fixes them.
I just ran my first JNI test and it worked.
(Don't get too happy yet -- it only works if your JNI method doesn't
actually try to use its arguments.)
2000-02-10 Tom Tromey <tromey@cygnus.com>
* include/jni.h (JNI_FALSE): Renamed from JNI_TRUE; oops.
(jboolean): Declare as an attributed int, not a bool.
(_Jv_func): Declare differently for C.
Tom
Index: include/jni.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/include/jni.h,v
retrieving revision 1.10
diff -u -r1.10 jni.h
--- jni.h 2000/02/10 20:31:48 1.10
+++ jni.h 2000/02/10 23:38:50
@@ -34,7 +34,7 @@
typedef int jshort __attribute__((__mode__(__HI__)));
typedef int jint __attribute__((__mode__(__SI__)));
typedef int jlong __attribute__((__mode__(__DI__)));
-typedef bool jboolean __attribute__((__mode__(__QI__)));
+typedef int jboolean __attribute__((__mode__(__QI__)));
typedef unsigned short jchar __attribute__((__mode__(__HI__)));
typedef float jfloat;
typedef double jdouble;
@@ -62,8 +62,8 @@
typedef const struct JNINativeInterface *JNIEnv;
typedef const struct JNIInvokeInterface *JavaVM;
-#define JNI_TRUE 1
-#define JNI_TRUE 0
+#define JNI_TRUE 1
+#define JNI_FALSE 0
#endif /* __cplusplus */
@@ -117,7 +117,11 @@
jobject l;
} jvalue;
-typedef void * (*_Jv_func)(...);
+#ifdef __cplusplus
+typedef void * (*_Jv_func) (...);
+#else
+typedef void * (*_Jv_func) ();
+#endif
/* This structure is used when registering native methods. */
typedef struct
More information about the Java-patches
mailing list