JNI数据类型互转

类型 java->c/c++ c/c++->java
布尔 bool mBool =mjboolean jboolean mjboolean= mBool
字符串 char cstr = (env).GetStringUTFChars(mjstring, JNI_FALSE); char cstr[50] = "xxx";jstring mjstring = env->NewStringUTF(cstr1)
字符 char cchar = mjchar jchar mjchar = cchar
short short cshort = mjshort jshort mjshort = cshort
double double cdouble = mjdouble jdouble mjdouble = cdouble
整型 int cint = mjint jint mjint = cint
浮点 float cfloat = mjfloat jfloat mjfloat = cfloat

基本类型是可以直接进行赋值的,字符串c/c++与Java的概念不一致需要进行重新创建。

发表评论

CAPTCHAis initialing...