This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: Add JNIEXPORT and JNICALL to native methods in JNI testcases


Hi,

    The native methods in the JNI test cases in
"libjava/testsuite/libjava.jni" are not defined with JNIEXPORT
and JNICALL attributes as required by JNI. This causes
them to fail to even *build* on Win32 as the gcjh generated
header declares these methods with JNIEXPORT and JNICALL.

The following patch proposes to fix this.

I apologise for not noticing this earlier.

ChangeLog:

        * libjava.jni/calls.c (Java_calls_docall): Define with
        JNIEXPORT and JNICALL method attributes.
        * libjava.jni/field.c (Java_field_fetch): Likewise.
        * libjava.jni/final_method.c (Java_final_1method_meth): Likewise.
        * libjava.jni/findclass.c (Java_findclass_doit): Likewise.
        * libjava.jni/invoke.c (Java_invoke_val): Likewise.
        * libjava.jni/martin.c (Java_martin_myNative): Likewise.
        * libjava.jni/noclass.c (Java_noclass_find_1it): Likewise.
        * libjava.jni/overload.c (Java_overload_over__I): Likewise.
        (Java_overload_over__II): Likewise.
        * libjava.jni/register.c (JNI_OnLoad): Likewise.
        * libjava.jni/simple_int.c (Java_simple_1int_nat): Likewise.
        * libjava.jni/throwit.c (Java_throwit_throwit): Likewise.
        * libjava.jni/virtual.c (Java_virtual_equals): Likewise.

Patch:
------------------------------- 8< -------------------------------
--- libjava.jni/calls.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/calls.c	Fri Jan 24 00:00:08 2003
@@ -2,5 +2,5 @@
 #include <calls.h>

-jint
+JNIEXPORT jint JNICALL
 Java_calls_docall (JNIEnv *env, jobject _this)
 {
--- libjava.jni/field.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/field.c	Fri Jan 24 00:00:20 2003
@@ -2,5 +2,5 @@
 #include <field.h>

-jobjectArray
+JNIEXPORT jobjectArray JNICALL
 Java_field_fetch (JNIEnv *env, jobject this)
 {
--- libjava.jni/final_method.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/final_method.c	Fri Jan 24 00:00:30 2003
@@ -1,5 +1,5 @@
 #include <final_method.h>

-jstring
+JNIEXPORT jstring JNICALL
 Java_final_1method_meth (JNIEnv *env, jobject thisv)
 {
--- libjava.jni/findclass.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/findclass.c	Fri Jan 24 00:00:40 2003
@@ -3,5 +3,5 @@
 #include <findclass.h>

-jclass
+JNIEXPORT jclass JNICALL
 Java_findclass_doit (JNIEnv *env, jclass klass, jstring name)
 {
--- libjava.jni/invoke.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/invoke.c	Fri Jan 24 00:00:58 2003
@@ -1,5 +1,5 @@
 #include <invoke.h>

-jint
+JNIEXPORT jint JNICALL
 Java_invoke_val (JNIEnv *env, jclass klass)
 {
--- libjava.jni/martin.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/martin.c	Fri Jan 24 00:01:26 2003
@@ -3,5 +3,6 @@
 #include <stdio.h>

-void Java_martin_myNative(JNIEnv* env, jobject this, jstring s)
+JNIEXPORT void JNICALL
+Java_martin_myNative(JNIEnv* env, jobject this, jstring s)
 {
   jclass cls;
--- libjava.jni/noclass.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/noclass.c	Fri Jan 24 00:01:36 2003
@@ -1,5 +1,5 @@
 #include <noclass.h>

-void
+JNIEXPORT void JNICALL
 Java_noclass_find_1it (JNIEnv *env, jclass k)
 {
--- libjava.jni/overload.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/overload.c	Fri Jan 24 00:01:54 2003
@@ -1,5 +1,5 @@
 #include <overload.h>

-jint
+JNIEXPORT jint JNICALL
 Java_overload_over__I (JNIEnv *env, jclass klass, jint val)
 {
@@ -8,5 +8,5 @@


-jint
+JNIEXPORT jint JNICALL
 Java_overload_over__II (JNIEnv *env, jclass klass, jint one, jint two)
 {
--- libjava.jni/register.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/register.c	Fri Jan 24 00:03:38 2003
@@ -9,5 +9,5 @@
 }

-jint
+JNIEXPORT jint JNICALL
 JNI_OnLoad (JavaVM *vm, void *nothing)
 {
--- libjava.jni/simple_int.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/simple_int.c	Fri Jan 24 00:03:48 2003
@@ -1,5 +1,5 @@
 #include <simple_int.h>

-jint
+JNIEXPORT jint JNICALL
 Java_simple_1int_nat (JNIEnv *env, jclass klass, jint val)
 {
--- libjava.jni/throwit.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/throwit.c	Fri Jan 24 00:04:02 2003
@@ -2,5 +2,5 @@
 #include <throwit.h>

-void
+JNIEXPORT void JNICALL
 Java_throwit_throwit (JNIEnv *env, jclass klass, jstring name,
 		      jboolean is_new)
--- libjava.jni/virtual.c	Thu Jan 23 23:59:48 2003
+++ libjava.jni/virtual.c	Fri Jan 24 00:04:14 2003
@@ -1,5 +1,5 @@
 #include <virtual.h>

-jboolean
+JNIEXPORT jboolean JNICALL
 Java_virtual_equals (JNIEnv *env, jobject thisv, jobject other)
 {
------------------------------- 8< -------------------------------

Sincerely Yours,
Ranjit.

--
Ranjit Mathew        Email: rmathew AT hotmail DOT com
Bangalore,
INDIA.               Web: http://ranjitmathew.tripod.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]