当前位置: 技术问答>java相关
有请写过jni的朋友
来源: 互联网 发布时间:2015-04-14
本文导语: java通过jni调用本地DLL 编译出错 error C2819: type 'JNIEnv_' does not have an overloaded member 'operator ->' 请问这是什么问题,如果把env相关的语句注释掉,就可以编译通过 dll的源文件 #include #include "MyNative.h" JNIEXPOR...
java通过jni调用本地DLL
编译出错 error C2819: type 'JNIEnv_' does not have an overloaded member 'operator ->'
请问这是什么问题,如果把env相关的语句注释掉,就可以编译通过
dll的源文件
#include
#include "MyNative.h"
JNIEXPORT void JNICALL Java_MyNative_showParms0
(JNIEnv *env, jobject obj, jstring s, jint i, jboolean b)
{
printf("print in DLLn");
const char* szStr = (*env)->GetStringUTFChars( env, s, 0 );
//printf( "String = [%s]n", szStr );
printf( "int = %dn", i );
printf( "boolean = %sn", (b==JNI_TRUE ? "true" : "false") );
//(*env)->ReleaseStringUTFChars( env, s, szStr );
}
编译出错 error C2819: type 'JNIEnv_' does not have an overloaded member 'operator ->'
请问这是什么问题,如果把env相关的语句注释掉,就可以编译通过
dll的源文件
#include
#include "MyNative.h"
JNIEXPORT void JNICALL Java_MyNative_showParms0
(JNIEnv *env, jobject obj, jstring s, jint i, jboolean b)
{
printf("print in DLLn");
const char* szStr = (*env)->GetStringUTFChars( env, s, 0 );
//printf( "String = [%s]n", szStr );
printf( "int = %dn", i );
printf( "boolean = %sn", (b==JNI_TRUE ? "true" : "false") );
//(*env)->ReleaseStringUTFChars( env, s, szStr );
}
|
Kao:
const char *szStr = env->GetStringUTFChars(s,0);
const char *szStr = env->GetStringUTFChars(s,0);
|
换成env->试下