I've tried the test with winelib and got:
$ winegcc test.c $ ./a.out > nya $ od -x nya 0000000 3f3f 3f3f 3f3f 3f3f 0066 0000011
This output differs from previous. I tried this under several locales, the results are the same.
test.c: void main() { wprintf(L"test with wprintf"); }
I continued my investigation of this problem and what I figured out:
1) no options for winegcc: $ winegcc test.c $ ./a.out > out $ od -x out 0000000 3f3f 3f3f 3f3f 3f3f 0066 0000011
2) -mno-cygwin $ winegcc -mno-cygwin test.c $ ./a.out > out $ od -x out 0000000 6574 7473 7720 7469 2068 7077 6972 746e 0000020 0066
This is OK.
I tried -mconsole option too, but it did not make any difference.
So -mno-cygwin option heals the program. What magic does -mno-cygwin option? I cannot understand, why it is necessary. Moreover, tests for msvcrt are OK without -mno-cygwin.
-- Kirill