[Wine] Can't run console hello world

Yang Zhang yanghatespam at gmail.com
Wed Oct 14 02:31:16 CDT 2009


Hi, I have a console hello world (built with mingw), and it runs fine
in Windows, but I can't get it to print anything under Wine on Linux,
despite the fact that
http://www.winehq.org/docs/wineusr-guide/cui-programs claims that
"wine ./a.exe" should match up the IO streams. Thanks in advance for
any hints.

$ cat hello.c
#define UNICODE
#include <windows.h>
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
               int nCmdShow) {
  wchar_t str[] = L"hello, world!\n";
  DWORD count;
  WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
               str,
               sizeof str / sizeof(wchar_t),
               &count,
               NULL);
  return 0;
}

$ i586-mingw32msvc-gcc hello.c

$ file ./a.exe
./a.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit

$ wine ./a.exe

$
-- 
Yang Zhang
http://www.mit.edu/~y_z/



More information about the wine-users mailing list