Want to force wchar_t to be an unsigned short using the Android NDK
wchar_t is reportedly useless and not supported in Android NDK development. If this is the case what would I need to do so that wchar_t is defined as an unsigned short?
This would help immensely in porting over native library that references wchar_t and would also seem to be a better fit with JNI's understanding of Unicode. GetStringUTFChars() returns const char * and GetStringChars() returns const jchar * with jchar b开发者_运维知识库eing defined as an unsigned short (2 bytes). Defining wchar_t as an unsigned short would make it compatible with GetStringChars() and seemingly make my life much easier.
Is it possible? What would it take? I'm thinking it would require hacking up and rebuild the toolchain.
gcc knows the option -fshort-wchar. I don't know if the compiler in the Android does support this option.
The point is, I think, if your native library uses the wide string functions of the C-RTL? In this case, you need to provide these implementations yourself.
精彩评论