Reputation: 185
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 being 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.
Upvotes: 1
Views: 1560
Reputation: 3069
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.
Upvotes: 1