2 byte wchar_t ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User12216
Level 2
Level 2
First like received
Hi,
We are working on a project that displays lots of different text in different languages. The supporting characters fit within UTF16 space and I am using wchar_t as my character type. I set the gcc and g++ command line option to -fshort-wchar to conserve memory (we have a lot of stored text strings in flash) but I get a lot of linker warnings regarding libraries using 4-byte wchar_t when my code is using 2-byte wchar_t (libg.a, libstdc++.a, etc.). Is there a set of DAVE libraries that support this?

I am going to guess the answer is 'no' and I would need to roll my own functions that use wchar_t. I am hoping for an answer before I go down this path....

Thanks,
Paul
0 Likes
2 Replies
User12216
Level 2
Level 2
First like received
Just a follow-up. I punted on the wchar_t approach and went with MBCS via utf8. It saves a bunch of storage space and the on-the-fly conversion is not a big hit in performance.
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
DAVE is using the precompiled arm gcc standard libraries.
I found the following https://stackoverflow.com/questions/19489354/how-to-set-2-byte-wchar-t-output that may help you.
0 Likes