Sunday, October 23, 2011

Android NDK no love for wchar_t

I had to port some existing C/C++ code to Android (NDK) recently.
The code was using wchar_t and wstring quite often.
After a bit of research found out that it might not be as easy as I initially thought.

Basically, the wchar_t support is broken and most of the w* functions are not implemented as far as I can tell.
The wchar_t was essentially defined as one byte char before Android Froyo (2.2) and only starting from 2.3 it is 4 bytes long.

Here is the quite entertaining comment from their wchar.h file:

/* IMPORTANT: Any code that relies on wide character support is essentially
 *            non-portable and/or broken. the only reason this header exist
 *            is because I'm really a nice guy. However, I'm not nice enough
 *            to provide you with a real implementation. instead wchar_t == char
 *            and all wc functions are stubs to their "normal" equivalent...
 */

Is seems like there are at least couple of possible ways to solve this problem:
1. Fix the existing code, and remove the dependency on wchar_t (wstring etc).
2. Try to use the CrystaX android development toolkit instead, that seems to have a better support for wchar_t and other w* APIs: http://www.crystax.net/en/android/ndk/6

Will continue digging into this tomorrow.

Wednesday, October 12, 2011

MIRcon 2011

I'm attending the MIRcon 2011 conference - the second annual conference on information security that my company organizes:

http://www.mandiant.com/news_events/article/mircon_event_page

The conference is open to everybody and it is free.

Here is the couple of thoughts after the first day:
1. It's amazing how much is going on in the area of cyber security, cyber attacks prevention and instant response. Some of the stories can really make you paranoid about security of your personal data and especially (oh so popular)  the cloud security.
2. Ditch Windows. I haven't been using Windows OS actively recently. I'm doing fine with Mac OS X as my primary development platform and different distros of Linux (Ubuntu, CentOS, etc.). Windows is not doing good against the cyber attacks in part because of the properties of OS itself and in part of how popular it is. The more I get familiar with different flavors of *nix (Linux, BSD, etc), the more I get impression that it's kind of more difficult to make some consistent low level type of malware or find some common security vulnerability that can be scaled well, because the *nix distros are different, with possibly different vulnerabilities and differently broken APIs.

Looking forward to the second day of the conference.

Saturday, October 08, 2011

printf ("Goodbye Dennis Ritchie");

Rest in peace Dennis Ritchie


Wednesday, October 05, 2011

Rest in Peace Steve Jobs

Steve Jobs, Apple co-founder and former CEO, has died at the age of 56. So sad :(

Rest in peace Steve ....
http://www.apple.com/stevejobs