首先,用不同语言编译so文件时,内容是不同的 例(C语言): #include <jni.h> #include <string.h> #include <stdio.h> jstring Java_com_Ndktest_Ndktest1_stringFromJNI( JNIEnv* env,jobject thiz ) { printf("hello"); return 0; } 但是C++则需要如下: #include <jni.h> #include <string.h> #include <stdio.h> using namespace std; extern "C" { JNIEXPORT jstring JNICALL Java_com_Ndktest_Ndktest1_stringFromJNI( JNIEnv* env,jobject thiz ) { printf("hello"); return 0; } } |
|