问题描述
我有一个游戏,它使用的std :: wstring的作为地方千元的基本字符串类型,以及与wchar_t的做业务及其功能:wcslen wcsicmp()()vsprintf中()等
I have a game which uses std::wstring as its basic string type in thousand of places as well as doing operations with wchar_t and its functions: wcsicmp() wcslen() vsprintf(), etc.
问题是wstring的在R5C不支持(在该书面方式时最新的NDK)。
The problem is wstring is not supported in R5c (latest ndk at the time of this writting).
我无法改变code使用std ::字符串,因为国际化,我会打破它被许多游戏的游戏引擎...
I can't change the code to use std::string because of internationalization and I would be breaking the game engine which is used by many games ...
我有哪些选择?
1 - 替换字符串,用我自己的字符串类wstring的
这会给我更好的平台独立性,但它是荒谬重新实现车轮。
我已经开始与一头牛的实现字符串。我需要它是COW,因为我用它们作为hash_maps键。
这当然是大量的工作,而且容易出错的......但现在看来,这是我能做到的。
This would give me better platform independency, but it is ridiculous to reimplement the wheel.I've already started with a COW implementation of strings. I need it to be COW because I use them as keys in hash_maps.This is of course lots of work and error prone ... but it seems it is something I can do.
2 - 尝试修复NDK重新编译用我自己的C-非标准库的宽字符字符串函数(wcslen,mbstowcs ...)
这将是preferable方式......但我不知道如何做到这一点:(
This would be the preferable way ... but I have no idea how to do it :(
如何更换功能(可以说wcslen)中的libstdc ++,一个或libstlport_static.a? (不知道在哪里,他们是:()
How do I replace a function (lets say wcslen) in the libstdc++.a or libstlport_static.a? (not sure where they are :()
和以及我不知道我需要重新实现它的功能,我知道wcslen不能正常工作,所以我想他们应该是所有...
And as well I'm not sure which functions I need to reimplement, I know wcslen is not working so I guess they should be all ...
3 - 你还有什么其他的想法
我不能等待此官方补丁,我将有选择#1走,如果我不能知道怎么办#2。
I can't wait for an official fix for this and I will have to go with option #1 if I can't realize how to do #2.
我读的地方,如果你的目标2.3,你可以使用wstrings,但我应该定位到Android 2.1。
I've read somewhere that if you target 2.3 you can use wstrings, but I ought to target Android 2.1.
PS:忘了说我需要使用当然STL,但没有RTTI,我生活中可以没有例外
PS: Forgot to say I need to use STL of course, but no RTTI and I can live without exceptions.
在此先感谢!
推荐答案
试用CrystaX的NDK。它已STL支持谷歌官方的一个长了。当前版本(R5),这是基于该官方NDK R5的,仍然是Beta 3中,但它确实有wchar_t的支持。
Try out CrystaX's NDK. It has had stl support long before the official google one. The current version (r5), which is based off the of the official ndk r5, is still beta 3, but it does have wchar_t support.
这篇关于解决方案缺少的std :: Android中NDK wstring的支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!