make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw make problem


From: William A. Hoffman
Subject: Re: mingw make problem
Date: Fri, 18 Aug 2006 14:00:55 -0400

At 12:56 PM 8/18/2006, William A. Hoffman wrote:

>OK, but there seems to be some extra work that needs to be done in
>CreateProcess to get the arguments correct.

Brad King who did the process execution stuff in cmake, had similar problems
with CreateProcess.   I asked him to comment on the issue.  Here 
is his comment along with a test program he used to debug a similar problem
in Cmake:


At 01:21 PM 8/18/2006, Brad King wrote:
>William A. Hoffman wrote:
>> So, can you explain the CreateProcess issue you found in kwsys with 
>> arguments,
>> and why it seems to be merging the quoted arguments?
>
>On windows there is no such thing as an argument vector when creating a
>process.  There is just a single string forming the full command line,
>and it is passed as the second argument to CreateProcess.
>
>I used the program below to display the string passed to CreateProcess
>when calling the program, and the arguments that the runtime library
>parses out of this string and passes to argv.  Experimenting by hand
>after that enabled me to reverse engineer the way the runtime library
>parses the command line into arguments.  From that I designed code to
>take a vector of arguments and generate the command line string to
>reproduce the arguments exactly after parsing by the child's runtime
>library.
>
>If you run this program from that makefile you will see that the command
>line actually received by the program is
>
>  c:\full\path\to\runDump.exe "a.c b.c"
>
>Note that if you run the program from a command prompt with the line
>
>  c:\full\path\to\runDump.exe a.c" "b.c
>
>it will see the single argument {a.c b.c}.  I suspect that the make
>implementation is removing the outer layer of quotes from {"a.c" "b.c"}
>to leave this broken command line behind.
>
>-Brad
>
>
>#include <windows.h>
>#include <stdio.h>
>
>int main(int argc, char* argv[])
>{
>  int i;
>  fprintf(stdout, "command line = {%s}\n", GetCommandLine());
>  for(i=0; i < argc; ++i)
>    {
>    fprintf(stdout, "argv[%d] = {%s}\n", i, argv[i]);
>    }
>  return 0;
>}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]