CreateProcess() - executed program gets different argument depending if it's compiled with gcc (cygwin) or cl (VS)?

Piotr Krukowiecki piotr.krukowiecki.news@gmail.com
Fri Feb 19 12:52:00 GMT 2010


On Fri, Feb 19, 2010 at 1:37 PM, Piotr Krukowiecki wrote:
> On Thu, Feb 18, 2010 at 9:45 PM, Larry Hall (Cygwin) wrote:
>> On 02/18/2010 03:24 PM, Piotr Krukowiecki wrote:
>>> On Thu, Feb 18, 2010 at 7:02 PM, Larry Hall (Cygwin)
>>>> On 02/18/2010 12:55 PM, Piotr Krukowiecki wrote:
>>>>> - if the executed program is compiled with cygwin's gcc the program
>>>>> receives \127.0.0.127\foo.cxx (just one backslash at the begining).
>>>>> - if it's compiled with cl it gets \\127.0.0.127\foo.cxx (double
>>>>> backslash - what I expected)
>>>>
>>>> '\' is an escape character in C, Unix, and Linux.  In Windows, it's a
>>>> path separator.  Use '/' instead when working with Cygwin and you'll
>>>> avoid allot of problems.  Better yet, use POSIX paths exclusively.
[...]
> I don't know which program (cygwin/windows) is going to be executed.
> Do I have to check before execution if the program is compiled under
> cygwin and implement different logic in that case? From what I
> understood so far this is the only way?

There's another confusing behaviour: backslashes seem to be treated as
escape characters only if inside quotes:

Command: F:\t\dumpargs_gcc.exe  "\\foo" \\bar
/cygdrive/f/t/dumpargs_gcc
\foo
\\bar

Command: F:\t\dumpargs_cl.exe  "\\foo" \\bar
F:\t\dumpargs_cl.exe
\\foo
\\bar

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list