delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/10/14:49:02

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 10 Sep 2004 14:48:24 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Chuck McDevitt <cmcdevitt AT ABINITIO DOT COM>
cc: "David A. Rogers" <darogers AT speakeasy DOT net>, cygwin AT cygwin DOT com,
Dave Korn <dk AT artimi DOT com>
Subject: RE: cygwin 1.5.11: execv doesn't set argv[0] on Windows programs
In-Reply-To: <OF11317D53.7B086299-ON85256F0B.006544CE-85256F0B.0065AD2C@abinitio.com>
Message-ID: <Pine.GSO.4.61.0409101444530.14874@slinky.cs.nyu.edu>
References: <OF11317D53 DOT 7B086299-ON85256F0B DOT 006544CE-85256F0B DOT 0065AD2C AT abinitio DOT com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Fri, 10 Sep 2004, Chuck McDevitt wrote:

> argv and argc are concepts from the C runtime, not the Windows OS.
>
> The actual entry point to your program is to a routine that calls the
> initialization routines of the C library, then calls winMain.
>
> Those initialization routines get the command line via Win32 call,
> allocates memory for argv, and parses the command line.
>
> Windows itself has no requirement that an application support argv and
> argc, and in fact programs in other languages (VB etc) don't have any such
> concept.

Ok, so I didn't use quite the right phrasing, but I believe it's been
explained adequately since.

> Cygwin, when launching an application, just needs to make sure the
> CreateProcess call has the command line passed to it.
> Everything else is handled by the the receiving program (via C runtime, if
> a C program).

Exactly, with one small clarification: "Cygwin, when launching an
application, just needs to make sure the CreateProcess call has the
*right* command line passed to it.".  Currently, spawn_guts() munges the
first token in that command line to match the image name, even if
instructed otherwise (via the args array).
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019