The wchar_t type has different standard
sizes in Unix (4 bytes) and Windows (2 bytes). You need a
recent gcc version (2.9.7 or later) that supports the
-fshort-wchar option to set the
size of wchar_t to the one expected
by Windows applications.
If you are using Unicode and you want to be able to use
standard library calls (e.g. wcslen,
wsprintf), then you must use
the msvcrt runtime library instead of glibc. The functions in
glibc will not work correctly with 16 bit strings.