[Kaffe] patch for JNI problem with kaffeh

Moses DeJong dejong at cs.umn.edu
Fri Jan 15 14:38:40 PST 1999


Here is a little patch that fixes the JNI problems in kaffeh. The
generated .c files now use JNIEXPORT and JNICALL in the functions.
It also fixes a problem with the -o argument to kaffeh.


diff -r -c tmp/kaffe/include/jni.h kaffe/include/jni.h
*** tmp/kaffe/include/jni.h	Mon Jan 11 06:32:05 1999
--- kaffe/include/jni.h	Wed Jan 13 17:23:52 1999
***************
*** 29,35 ****
  extern "C" {
  #endif
  
! #define	JNIEXPORT
  #define	JNICALL
  
  struct JNIEnv_;
--- 29,35 ----
  extern "C" {
  #endif
  
! #define	JNIEXPORT extern
  #define	JNICALL
  
  struct JNIEnv_;
diff -r -c tmp/kaffe/kaffe/kaffeh/main.c kaffe/kaffe/kaffeh/main.c
*** tmp/kaffe/kaffe/kaffeh/main.c	Tue Aug 25 22:10:08 1998
--- kaffe/kaffe/kaffeh/main.c	Wed Jan 13 17:50:45 1999
***************
*** 64,74 ****
--- 64,90 ----
  		if (flag_jni != 0) {
  			jni_include = file;
  			strcpy(className, outputName);
+  			i = 0;
+ 			while(className[i] != 0) {
+ 			  if (className[i] == '.') {
+ 			    className[i] = '_';
+ 			  }
+ 			  i++;
+ 			}
+ 			/*printf("jni className is \"%s\"\n", className);*/
  			initJniInclude();
  		}
  		else {
  			include = file;
  			strcpy(className, outputName);
+  			i = 0;
+ 			while(className[i] != 0) {
+ 			  if (className[i] == '.') {
+ 			    className[i] = '_';
+ 			  }
+ 			  i++;
+ 			}
+ 			/*printf("className is \"%s\"\n", className);*/
  			initInclude();
  		}
  	}
diff -r -c tmp/kaffe/kaffe/kaffeh/support.c kaffe/kaffe/kaffeh/support.c
*** tmp/kaffe/kaffe/kaffeh/support.c	Tue Jan  5 03:29:50 1999
--- kaffe/kaffe/kaffeh/support.c	Wed Jan 13 16:29:49 1999
***************
*** 382,388 ****
  	}
  
  	if (jni_include != 0) {
! 		fprintf(jni_include, "extern ");
  		switch (*ret) {
  		case '[':
  			fprintf(jni_include, "jarray");
--- 382,388 ----
  	}
  
  	if (jni_include != 0) {
! 		fprintf(jni_include, "JNIEXPORT ");
  		switch (*ret) {
  		case '[':
  			fprintf(jni_include, "jarray");
***************
*** 431,437 ****
  				className, name);
  			exit(0);
  		}
! 		fprintf(jni_include, " Java_%s_%s(JNIEnv*", className, name);
  		if ((m.access_flags & ACC_STATIC)) {
  			fprintf(jni_include, ", jclass");
  		}
--- 431,437 ----
  				className, name);
  			exit(0);
  		}
! 		fprintf(jni_include, " JNICALL Java_%s_%s(JNIEnv*", className, name);
  		if ((m.access_flags & ACC_STATIC)) {
  			fprintf(jni_include, ", jclass");
  		}



More information about the kaffe mailing list