From: DAUTREVAUX AT microprocess DOT com (Bernard Dautrevaux) Subject: RE: Mingw32 egcs 1.1.1, GCC_EXEC_PREFIX and CreateProcess 6 Jan 1999 10:27:13 -0800 Message-ID: <8135911A809AD211AF6300A02480D1750348A7.cygnus.gnu-win32@IIS000.microdata.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit To: "'Mumit Khan'" , Gilles Depeyrot Cc: gnu-win32 AT cygnus DOT com > -----Message d'origine----- > De: Mumit Khan [SMTP:khan AT xraylith DOT wisc DOT EDU] > Date: Tuesday, January 05, 1999 08:00 > À: Gilles Depeyrot > Cc: gnu-win32 AT cygnus DOT com > Objet: Re: Mingw32 egcs 1.1.1, GCC_EXEC_PREFIX and > CreateProcess > > Gilles Depeyrot writes: > > Hi everyone, > > > > I'm having a problem with Mingw32 egcs-1.1.1 concerning the > > GCC_EXEC_PREFIX environment variable. > > > > I launch and run egcs from inside an Win32 application using > > a call to CreateProcess. This works fine except for the fact > > that in this case, GCC_EXEC_PREFIX *must* be defined or I get > > an error message: > > > > gcc: installation problem, unable to exec `cpp' > > Thanks for this very useful data point. I'm not sure why, but > my guess is that CreateProcess does not fill in the argv[0] with > the full pathname, and then GCC can't figure out where to look. > CreateProcess does not fill anything! you must pass both the file name and argv[0]... Note also there is various incompatibilities depending on the system you're running on (3.x/95/98/NT) and the kind of exe you're starting (16/32 bits). Even Micro$oft agrees it's clumsy and difficult to understand... I think I've read that the best way when calling CreateProcess is to pass a null pointer as the name of program file to load and to put the full path-name in the argv[0] image. HOWEVER, CreateProcess do not accept argv[], but an argument block where you are expected to put all the arguments (space sparated, and quoted with quite bizarre rules if they contain spaces or semicolons, and null terminated), the environments (null separated A=b strings I think) as well as information on the mapping of Windows file handles to C-run-time files (to pass stdin/stdout/stderr for example)... If you look at the spawnvpe source code in VC++ library source you'll understand this is quite awkward (this is 3 or 4 source files summing up more than 1000 lines I think...) MORALITY: If you need to start any program use spawn, NOT CreateProcess (and if possible use msvcrt.dll, NOT crtdll.dll, as the latter limits the total size of the argument block, args + env, to 1024 bytes...). > This is also useful for folks using IDEs such as Quincy or Vide > with mingw or cygwin. > All depends on the method they use to start-up GCC: spawn or manually calling CreateProcess... spawn() should work fine. > Regards, > Bernard ------------------------------------------------------------------------ ------ Bernard Dautrevaux Microprocess Ingéniérie 97 bis, rue de Colombes 92400 COURBEVOIE FRANCE Tel: +33 (0) 1 47 68 80 80 Fax: +33 (0) 1 47 88 97 85 e-mail: dautrevaux AT microprocess DOT com b DOT dautrevaux AT usa DOT net ------------------------------------------------------------------------ ------ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".