X-Spam-Check-By: sourceware.org Message-ID: <44689C8D.A2E6459C@dessent.net> Date: Mon, 15 May 2006 08:21:49 -0700 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: rvxt-20050409-1 console problem References: Content-Type: text/plain; charset=iso-8859-1 X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k4FFMREk006084 Sven Köhler wrote: > AFAIK, there are EXE-files that open a console, and others, that don't. > > It seems, there is a flag in the EXE-files, which determines if Windows > should open a console or not. It is the "subsystem" flag in the PE header. This can be set by adding -Wl,--subsystem,windows (aka -Wl,-mwindows) or -Wl,--subsystem,console (aka -Wl,-mconsole). > So i always was annoyed by the fact, that starting rxvt directly from > windows opens a console windows. Use 'run'. Or, modulo the bug Igor is reporting, the latest refresh of rxvt. > Isn't it possible, to create such an EXE-file, that doesn't open a > console? Would that cause any problems with cygwin? > > That would make any "hide the console"-code unnecessary. This is not an option in the slightest. A -mwindows application cannot interact with the console it was invoked from! That means that all such compiled applications would have no I/O when invoked from the command line unless redirected to a file. Try compiling "int main() { puts("hello world"); }" with -mwindows and running it from a windows console -- you get nothing. -mwindows applications are expected to either have no console I/O or to explicitly create a new console themselves. What isn't possible is to attach to the existing console that it was run from. Note that I said *windows console*. This means from within CMD.EXE, without $CYGWIN=tty. If $CYGWIN=tty or you run from rxvt, xterm, over ssh, then you're using a pty, which is different than a windows console, and so the discussion is irrelevant. Note also that Microsoft added an API call in XP and later that lets a -mwindows compiled application attach to the existing console it was spawned in. This would allow the desired behavior (no new console created, but still able to interact with the existing one) but this would leave all users of nt/2k in the cold -- not an option. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/