Unicode functions

Francois Gouget fgouget at free.fr
Thu Sep 12 12:49:58 CDT 2002


On Thu, 12 Sep 2002 steve.lustbader at philips.com wrote:

> I think there is issue with _T(x).  I have this line in my Windows app
> that I'm compiling with WineLib (I'm using -fshort-wchar):
>
> const TCHAR *Name() const { return _T("my_name"); };
>
> The compiler gives me an error of:
>
> cannot convert `const __wchar_t *' to `const
> TCHAR *' in return

If you are using --fshort-wchar you should also use WINE_UNICODE_NATIVE
so that WCHAR gets defined to wchar_t. From winnt.h:

#ifdef WINE_UNICODE_NATIVE
typedef wchar_t         WCHAR,      *PWCHAR;
#else
typedef unsigned short  WCHAR,      *PWCHAR;
#endif

and further down:

/* Define WINE_UNICODE_NATIVE if:
 * - your compiler provides a 16bit wchar_t type, e.g. gcc >= 2.96 with
 *   -fshort-wchar option
 * - or if you decide to use the native 32bit Unix wchar_t type. Be aware
 *   though that the Wine APIs only support 16bit WCHAR characters for
 *   binary compatibility reasons.
 * - or define nothing at all if you don't use Unicode, and blissfully
 *   ignore the issue :-)
 */


Does that help?


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
May your Tongue stick to the Roof of your Mouth with the Force of a Thousand Caramels.




More information about the wine-devel mailing list