要强制wchar_t的是使用Android NDK的一个无符号短 [英] Want to force wchar_t to be an unsigned short using the Android NDK

查看:95
本文介绍了要强制wchar_t的是使用Android NDK的一个无符号短的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

wchar_t的据说是无用的,不支持的Andr​​oid NDK的发展。如果这是什么,我需要做的情况下,这样wcha​​r_t的被定义为一个无符号短?

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?

这将有助于极大的移植了本地库的引用wchar_t的,也似乎是一个更适合与统一code JNI的理解​​。 GetStringUTFChars()返回const char *与GetStringChars()返回常量jchar *与jchar被定义为一个无符号短(2字节)。 wchar_t的定义为一个无符号的短会使其与GetStringChars兼容的()和貌似让我的生活变得更轻松。

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.

推荐答案

GCC知道-fshort-WCHAR的选项。我不知道如果编译器在Android不支持此选项。

gcc knows the option -fshort-wchar. I don't know if the compiler in the Android does support this option.

的一点是,我认为,如果你的本机库采用了C-RTL的宽字符串函数?在这种情况下,你需要提供这些实现自己。

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.

这篇关于要强制wchar_t的是使用Android NDK的一个无符号短的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆