This is the mail archive of the
mailing list for the GCC project.
Re: Problem with pex-win32.c
- From: "Lucas (a.k.a T-Bird or bsdfan3)" <tbird-contact at cox dot net>
- To: Ian Lance Taylor <ian at airs dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc at gcc dot gnu dot org
- Date: Fri, 10 Mar 2006 06:43:12 -0600
- Subject: Re: Problem with pex-win32.c
- References: <4410CB30.email@example.com> <firstname.lastname@example.org>
I'll happily test a patch to that file for you...the only box at my
house runs Windows... =-O
Ian Lance Taylor wrote:
Mark Mitchell <email@example.com> writes:
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?
I just copied the use of spawn from the earlier pex-win32
implementation. The pex_win32_exec_child function is basically
exactly the same code as before. I certainly have no objection to
using CreateProcess instead.
I could try a patch, but I can't test it, because I don't have a
Windows system. So it might be better if somebody else tackled it.