對於JNIEnv *env來講,在C中調用:di
(*env)->NewStringUTF(env, "Hello from JNI!");poi
而在C++中若是按照上述調用則會發生'base operand of '->' has non-pointer type '_JNIEnv''錯誤,須要以下調用:co
env->NewStringUTF("Hello from JNI!");jni
緣由:參見jni.h中對於JNIEnv的定義:錯誤
#if defined(__cplusplus)opera
typedef _JNIEnv JNIEnv;struct
#elseconst
typedef const struct JNINativeInterface* JNIEnv;
#endif