From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!feeder.erje.net!1.eu.feeder.erje.net!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Problems with the "mwindows" switch Date: Thu, 28 May 2015 17:19:07 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <00836c9e-9ed0-4638-9d0b-0b3cd4e07c65@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1432851548 15263 24.196.82.226 (28 May 2015 22:19:08 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 28 May 2015 22:19:08 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: number.nntp.giganews.com comp.lang.ada:193347 Date: 2015-05-28T17:19:07-05:00 List-Id: 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.