Skip to content

Latest commit

 

History

History
53 lines (50 loc) · 2.24 KB

customizing-c-command-line-processing.md

File metadata and controls

53 lines (50 loc) · 2.24 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager translation.priority.ht
Customizing C Command-Line Processing | Microsoft Docs
11/01/2016
visual-studio-dev14
devlang-cpp
article
C++
C
_spawn functions
command line, processing
command-line processing
startup code, customizing command-line processing
environment, environment-processing routine
_setargv function
command line, processing arguments
suppressing environment processing
_exec function
c20fa11d-b35b-4f3e-93b6-2cd5a1c3c993
7
mikeblome
mblome
ghogen
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

Customizing C Command-Line Processing

If your program does not take command-line arguments, you can save a small amount of space by suppressing use of the library routine that performs command-line processing. This routine is called _setargv (or _wsetargv in the wide-character environment), as described in Expanding Wildcard Arguments. To suppress its use, define a routine that does nothing in the file containing the main function and name it _setargv (or _wsetargv in the wide-character environment). The call to _setargv or _wsetargv is then satisfied by your definition of _setargv or _wsetargv , and the library version is not loaded.

Similarly, if you never access the environment table through the envp argument, you can provide your own empty routine to be used in place of _setenvp (or _wsetenvp), the environment-processing routine.

If your program makes calls to the _spawn or _exec family of routines in the C run-time library, you should not suppress the environment-processing routine, since this routine is used to pass an environment from the spawning process to the new process.

See Also

main Function and Program Execution