Opened 7 years ago

Closed 7 years ago

Last modified 12 months ago

#9461 closed patch (invalid)

Console application in MinGW

Reported by: SF/vakons Owned by: Kirben
Priority: normal Component: Port: Win32
Keywords: Cc:
Game:

Description

Currently, even if ScummVM was compiled under MinGW with "--enable-console" switch, it is still a regular GUI application without console window.

To show debug messages etc., even when already started from console, it calls AllocConsole() and creates additional window, but when the application terminates, this window closes too.

As a result, you can't see errors, or even help text when starting with "--help" switch.

The suggestion is to link a "console application with GUI" when "--enable-console" is used.
It will allow to keep all messages when ScummVM is started from Windows console.

To do this, 2 switches should be passed to linker: "-mwindows" and "-mconsole".
The "-mwindows" is already applied in "sdl-config", so here's the remaining one.

Was (line 2152 of "configure" script):
LIBS="$LIBS -lmingw32 -lwinmm -lgdi32"
OBJS="$OBJS scummvmwinres.o"

Change to:
LIBS="$LIBS -lmingw32 -lwinmm -lgdi32"
if test "$_text_console" = yes ; then
LIBS="$LIBS -mconsole"
fi
OBJS="$OBJS scummvmwinres.o"

Patched script attached (from 1.6.0git-1890-g78464a4, https://github.com/scummvm/scummvm/tree/78464a42d78091ac1b54c6ae18c3a67d90fb59bf).
md5: 507b6a9a6fce5cc2babc35bf818cc94a

P.S. Sorry for not making regular *.patch - I'm not sure what program I should use for that.

Ticket imported from: #3575582. Ticket imported from: patches/1566.

Attachments (1)

configure with enabled console.zip (28.0 KB ) - added by SF/vakons 7 years ago.
Added switch for "console application with GUI" linking.

Download all attachments as: .zip

Change History (6)

by SF/vakons, 7 years ago

Added switch for "console application with GUI" linking.

comment:1 by Kirben, 7 years ago

Owner: set to Kirben
Resolution: invalid
Status: newclosed

comment:2 by Kirben, 7 years ago

Closing as invalid, since this isn't a ScummVM issue.

Just remove ''-mwindows' from sdl-config, and ScummVM will default to a console application, with console output working correctly.

comment:3 by wjp, 7 years ago

Kirben, do you think we should always remove -mwindows from the sdl-config output?

comment:4 by Kirben, 7 years ago

Yes, always removing -mwindows from the sdl-config
output for mingw builds is a good idea,

comment:5 by digitall, 12 months ago

Component: Port: Win32
Note: See TracTickets for help on using tickets.