This is the mail archive of the
mailing list for the GCC project.
Problem with pex-win32.c
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Ian Lance Taylor <ian at airs dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 09 Mar 2006 16:41:20 -0800
- Subject: Problem with pex-win32.c
The new pex-win32.c code doesn't operate correctly when used for
MinGW-hosted tools invoked from a Cygwin window. In particular, process
creation ("gcc" invoking "as", say) results in a DOS console window
popping up. When invoked from a DOS window, things are fine.
The reason for this problem is that the current code uses MSVCRT's spawn
to create the process, and that function doesn't provide fine enough
control. You have to use CreateProcess to make this work as desired.
When invoking CreateProcess, you must set bInheritHandle to TRUE and
pass a long a STARTUPINFO structure with dwFlags set to
STARTF_USESTDHANDLES, and the various hStd* handle fields set to the
values from the calling process. (I'm pretty sure that CodeSourcery
posted patches that did that at one point; they were in our 3.4-based
You might think that linking with -mwindows would work, and, indeed that
avoids the DOS windows popping up in Cygwin -- but they you get no
output at all under Windows.
I guess I have two questions: (a) do you feel like fixing this, and (b)
if not, do you have any objection to using CreateProcess?
(650) 331-3385 x713