AW: winefile: UNICODE
ralfreit at gmx.at
Sat Jul 2 19:30:19 CDT 2005
> currently it's impossible to compile winefile in UNICODE mode
> with Wine without some extra rule for unixcalls.c in the
> Makefile. I tried it even without using any TCHAR functions
> or types, but inserting include/msvcrt in the include path
> conflicts with inclusion of the header files I need to call
> the Unix file system functions (that, which I moved out of
> the main module into the new module unixcalls.c).
I assume you only need include/msvcrt for unixcalls.c to be able to
include tchar.h. I assume the reason why tchar.h only works with msvcrt
is that gcc uses 4 bytes for wchar_t and wcs*() functions. Although you
can force gcc to use only 2 bytes (like it is the case in Windows), the
glibc wcs*() will most likely not behave correctly.
So I see two solutions:
(1) make a hard break and change the whole winefile to Unicode. For
unixcalls.c you can rely on the Windows API for manipulating Unicode
strings. Before calling the Unix functions, convert the Unicode string
to Ansi using WideCharToMultiByte(). Don't forget to add "-fshort-wchar"
to gcc options to get a 2 byte wchar_t.
(2) use TCHAR type. For unixcalls.c just be sure to include winnt.h
(should be included automatically). It defines the TCHAR type and the
TEXT() macro. For string manipulation you can again rely on the Windows
API functions like lstrcpyn, lstrcat etc.
Either way you can avoid to use msvcrt for unixcalls.c.
More information about the wine-devel