[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
jni.h fixes
From: |
Guilhem Lavaux |
Subject: |
jni.h fixes |
Date: |
Tue, 06 Jul 2004 19:48:27 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 |
Hi,
Merging jni.h with kaffe, we have noticed two problems:
* first, it is not compilable in C++ mode. I've fixed that by moving
some ifdef block and adding a '}' to finish the 'extern "C"' block.
* second, I think the definition for JNI_CreateJavaVM is slightly wrong.
Instead of
JNIEXPORT jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *);
I'd rather put:
JNIEXPORT jint JNICALL JNI_CreateJavaVM (JavaVM **, JNIEnv **, void *);
I have attached a patch.
Cheers,
Guilhem.
ChangeLog entry:
2004-07-06 Guilhem Lavaux <address@hidden>
* include/jni.h
(JNI_CreateJavaVM): Fixed prototype.
Fixed C++ compilation.
Index: include/jni.h
===================================================================
RCS file: /cvsroot/classpath/classpath/include/jni.h,v
retrieving revision 1.2
diff -u -r1.2 jni.h
--- include/jni.h 7 Jun 2004 21:42:59 -0000 1.2
+++ include/jni.h 6 Jul 2004 17:43:01 -0000
@@ -54,7 +54,26 @@
#ifdef __cplusplus
}
#endif
-
+
+/*
+ * Before jni.h is #included within a typical JVM, the source code should
+ * #define _JNI_VM_INTERNAL_TYPES_DEFINED and provide the real declarations
+ * for 'jobject', 'jfieldID', 'jMethodID' and other implementation types.
+ * If _JNI_VM_INTERNAL_TYPES_DEFINED is not defined, the following
+ * declares the old versions of the types.
+ */
+#ifndef _JNI_VM_INTERNAL_TYPES_DEFINED
+/*
+typedef void *jobject;
+typedef void *jfieldID;
+typedef void *jmethodID;
+*/
+struct _jfieldID;
+struct _jmethodID;
+typedef struct _jfieldID *jfieldID;
+typedef struct _jmethodID *jmethodID;
+#endif
+
#ifdef __cplusplus
class _jobject {};
@@ -92,25 +111,7 @@
#else /* __cplusplus */
-/*
- * Before jni.h is #included within a typical JVM, the source code should
- * #define _JNI_VM_INTERNAL_TYPES_DEFINED and provide the real declarations
- * for 'jobject', 'jfieldID', 'jMethodID' and other implementation types.
- * If _JNI_VM_INTERNAL_TYPES_DEFINED is not defined, the following
- * declares the old versions of the types.
- */
-#ifndef _JNI_VM_INTERNAL_TYPES_DEFINED
-/*
-typedef void *jobject;
-typedef void *jfieldID;
-typedef void *jmethodID;
-*/
-struct _jfieldID;
-struct _jmethodID;
-typedef struct _jfieldID *jfieldID;
-typedef struct _jmethodID *jmethodID;
-#endif
-
+
typedef void *jobject;
typedef jobject jclass;
typedef jobject jstring;
@@ -182,7 +183,7 @@
/* These functions are called by user code to start using the
invocation API. */
JNIEXPORT jint JNICALL JNI_GetDefaultJavaVMInitArgs (void *);
-JNIEXPORT jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *);
+JNIEXPORT jint JNICALL JNI_CreateJavaVM (JavaVM **, JNIEnv **, void *);
JNIEXPORT jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
@@ -467,6 +468,7 @@
};
#ifdef __cplusplus
+} /* Extern "C" */
struct _Jv_JNIEnv
{
- jni.h fixes,
Guilhem Lavaux <=