[hatari-devel] Console I/O on Windows
Nicolas Pomarède
npomarede at corp.free.fr
Tue Jan 4 23:24:40 CET 2011
Le 04/01/2011 21:39, Vincent Rivière a écrit :
> Nicolas Pomarède wrote:
>> 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).
>
> True.
>
> Furthermore, the gcc option "-mconsole" is translated to "--subsystem
> console" on the linker command line.
I guess that depends on the gcc version ; mine is really using
'-mconsole' when linking.
>> 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.
>
> Byte offset 0xdc
> 02: Windowed
> 03: Console
>
> The reference documentation is here:
> http://msdn.microsoft.com/en-us/library/ms680339(v=vs.85).aspx
> See the Subsystem member.
>
> And... many apologies.
> My hack tool toggled the subsystem, and I didn't notice it was the
> opposite of what I thinked :-[
>
> As Nicolas said, the current Hatari is compiled with an implicit
> -mconsole option. The subsystem is 03. And the console I/O does not work.
>
> But if you change the subsystem to 02 (or compile with -mwindows)
> everything work fine :-)
> If you double-click hatari.exe, there is no ugly console opened by default.
> If you make a shortcut to "hatari.exe -D", you get a console, debug
> output, and the debugger.
>
> Finally, the solution seems to be very simple.
> SDL really does black magic with stdio.
>
> Beware, if you close the console window, Hatari crashes. But this is
> another story.
>
I committed a change to the linker flags when building a win32 .exe to
include the "-mwindows" option now. This gives the same binary as
before, with only byte 0xdc being changed, so this should suppress the
console when running under Windows.
Nicolas
More information about the hatari-devel
mailing list