This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rvxt-20050409-1 console problem


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).

<http://msdn.microsoft.com/library/en-us/vccore/html/_core_.2f.SUBSYSTEM.asp>

> 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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]