Convert JNI types to Native types

后端 未结 6 475
温柔的废话
温柔的废话 2020-12-30 18:47

While there is documentation regarding turning a jstring to a native string (string nativeString = env->GetStringUTFChars(jStringVariable, NULL);

6条回答
  •  囚心锁ツ
    2020-12-30 19:15

    To cast a jboolean (which may only contain the values JNI_FALSE or JNI_TRUE) to a native bool I would use something like this :

    (bool)(jboolean == JNI_TRUE)
    

    If perhaps the jboolean isn't coming from the JVM, then testing for jboolean != JNI_FALSE might be considered safer.

提交回复
热议问题