winefile: UNICODE

Martin Fuchs fuchs.martin at gmail.com
Sun Jul 3 03:55:32 CDT 2005


Hello Ralf,

> 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

No, I don't need tchar.h in 'unixcalls.c'. I only needed it for 'winefile.c'. The problem is, if I add 'include/msvcrt' to the include path, it is added to both files at the same time.

> 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

I can't find a replacement for wcsrchr() in the windows API, so I have to include my own implementation in the source. There is also no equivalent of towupper(), so I have to change the pattern matching function a bit.

> 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.

I thought it is not allowed to use the "-fshort-wchar" option in Wine because not all compilers support it? If it is - using which macro should one add it to Makefile.in? Anyways - I don't need it, because there are no more literal wide string character constants.

Thanks,

   Martin




More information about the wine-devel mailing list