[hatari-devel] Console I/O on Windows

Nicolas Pomarède npomarede at corp.free.fr
Tue Jan 4 20:34:39 CET 2011


Le 04/01/2011 20:13, Eero Tamminen a écrit :
> Hi,
>
> On perjantai 31 joulukuu 2010, Vincent Rivière wrote:
>> I use the official Hatari 1.4.0 on Windows.
>>
>> When Hatari starts, it opens a console window, but it is useless because
>> it always remains empty. Debug output and debugger are unusable.
>>
>> It seems that Hatari is compiled as a graphical application (versus
>> console), then the console is opened afterwards. Unfortunately this does
>> not work, stdio and stderr are not routed to that console.
>>
>> Instead, when compiled with GCC, Hatari should be linked with
>> "--subsystem console" so the console will be automatically opened at
>> startup and everything will be fine.
>
> AFAIK Nicolas built the Windows version (using Linux cross-compiler for
> Hatari Windows binaries).
>

Hello,

Hatari is built under linux with mingw ; here're the last line to link 
hatari.exe :

/usr/bin/i586-pc-mingw32-gcc   -Wcast-qual -Wbad-function-cast 
-Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wall 
-Wwrite-strings -Wsign-compare -Wformat-security -O3 -DNDEBUG 
-Wl,--whole-archive CMakeFiles/hatari.dir/objects.a 
-Wl,--no-whole-archive  -o hatari.exe -Wl,--out-implib,libhatari.dll.a 
-Wl,--major-image-version,0,--minor-image-version,0 
-L/home/npomarede/src/hbuild_win/src/debug 
-L/home/npomarede/src/hbuild_win/src/falcon 
-L/home/npomarede/src/hbuild_win/src/gui-sdl 
-L/home/npomarede/src/hbuild_win/src/uae-cpu debug/libDebug.a 
falcon/libFalcon.a gui-sdl/libGuiSdl.a libFloppy.a uae-cpu/libUaeCpu.a 
-lmingw32 -Wl,-Bstatic -lSDLmain -Wl,-Bdynamic 
/usr/i586-pc-mingw32/sys-root/mingw/bin/SDL.dll -Wl,-Bstatic -lm 
-lSDLmain -Wl,-Bdynamic 
/usr/i586-pc-mingw32/sys-root/mingw/bin/readline.dll -lz -lpng -lws2_32 
/usr/i586-pc-mingw32/sys-root/mingw/bin/SDL.dll -Wl,-Bstatic -lm 
-Wl,-Bdynamic /usr/i586-pc-mingw32/sys-root/mingw/bin/readline.dll -lz 
-lpng -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 
-loleaut32 -luuid -lcomdlg32 -ladvapi32

According to gcc, -mconsole is the default when not specified and tells 
to build a console application.
-mwindows should be used to build a GUI application (it's not used here).

Vincent, could you tell me what bytes you changed (using an hex editor I 
guess) to modify the behaviour of the exe ? I will try to adapt the 
flags to get the same header.

Nicolas



More information about the hatari-devel mailing list