comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Problems with the "mwindows" switch
Date: Thu, 28 May 2015 17:19:07 -0500
Date: 2015-05-28T17:19:07-05:00	[thread overview]
Message-ID: <mk848s$esv$1@loke.gir.dk> (raw)
In-Reply-To: 00836c9e-9ed0-4638-9d0b-0b3cd4e07c65@googlegroups.com

<sbelmont700@gmail.com> wrote in message 
news:00836c9e-9ed0-4638-9d0b-0b3cd4e07c65@googlegroups.com...
>A Win32 executable is either 'console' or 'windows' (CUI or GUI).  This is, 
>effectively,
>what the -mwindows switch controls, with its omission indicating CUI.

>Essentially, a CUI executable gets its standard output handle from its 
>parent console; so
>if you spawn a CUI from the shell, it uses the same console for output, and 
>you get it in
>the same window as the shell.  Not so with a GUI app, that has no default 
>output, and
>would open a new window should you try (via AllocConsole()).

Right so far.

>So, if you use the -mwindows switch, you get no default console and your 
>text goes
>nowhere.  If you remove it, you will always get a console whether you want 
>it or not.
>There is, officially, no way to create a windows executable that is 
>dynamically both.

Of course there is, you just need some support from the runtime. For 
Janus/Ada we attempt to write to Text_IO for a GUI program create a console, 
else it's impossible to see what is going on when there is a problem at 
start up. I can't quite imagine how one could figure out anything without 
that, because its not at all unusual to have an exception raised during 
package elaboration, and there is no possible way to handle such an 
exception.

There is a weird effect with those windows, through, in that they appear and 
go away in a hurry when displaying unhandled exceptions. On some Windows 
systems, redirection works and you can capture the text that way. On other 
systems, it doesn't. I've never been able to figure out what controls that 
so I can suggest it to people (and set it myself).

                                      Randy.




  parent reply	other threads:[~2015-05-28 22:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 18:35 Problems with the "mwindows" switch NiGHTS
2015-05-22 19:24 ` sbelmont700
2015-05-22 19:51   ` NiGHTS
2015-05-23  5:33     ` Dmitry A. Kazakov
2015-05-23  7:20       ` NiGHTS
2015-05-23  8:06         ` Dmitry A. Kazakov
2015-05-28 22:19   ` Randy Brukardt [this message]
2015-05-28 23:49     ` sbelmont700
2015-05-29 21:24       ` Randy Brukardt
2015-05-29 21:36         ` Jeffrey R. Carter
2015-05-29 22:10           ` Simon Wright
2015-05-30  0:08           ` Dennis Lee Bieber
2015-06-01 21:24           ` Randy Brukardt
2015-06-01 23:12             ` sbelmont700
2015-05-29 11:00     ` Björn Lundin
2015-05-23 20:23 ` gautier_niouzes
2015-06-02 22:33   ` NiGHTS
2015-06-03  6:42     ` Simon Wright
2015-06-03  8:27       ` J-P. Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox