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

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

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 \\foo.cxx (just one backslash at the begining).
>>>> - if it's compiled with cl it gets \\\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.
>> "\\hostname" is remote path location, I don't think I can use
>> "//hostname" instead, either for cygwin program and especially not for
>> not-cygwin program, can I? (can't check it now)
> With Windows, you're free to use either path separator. ?With Cygwin,
> you're life will be easier if you use '/' though it will accept '\' too if
> properly escaped.
> Cygwin understands UNC path syntax using '/'. ?I would expect
> Windows to be cranky about '//' as a UNC path indicator though.
> If you need the source to compile, link, and run appropriately
> on either compiler, then you need to port it so it will, if that's
> what you're concerned about.

ok, so it works for paths - but what about other arguments, that are
not paths, just simple strings? They are also changed.
String "search \\me" is not the same as "search //me".

Example: given two "grep"-like programs, one compiled with cygwin, one
compiled without cygwin, I have to CreateProcess() with different
argument (different search string) to achieve same results - otherwise
one will search a file for "search \me" and the other for "search

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?

Piotr Krukowiecki

Problem reports:
Unsubscribe info:

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