Convert JNI types to Native types

后端 未结 6 511
温柔的废话
温柔的废话 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:01

    The odd one out is jchar. It's defined as unsigned short, and depending on your compilation settings, that may or may not be equivalent to wchar_t. Depending on your underlying platform, you may be better off working with UTF8 strings. At least those are bitwise equivalent to ASCII for the ASCII subset of characters.

    On Windows and Mac OS/Cocoa, however, the native wide string representation is exactly unsigned short. Java strings fit naturally into that.

提交回复
热议问题