This is the mail archive of the mailing list for the GCC 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]

Problem with pex-win32.c

Ian --

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?

Mark Mitchell
(650) 331-3385 x713

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