OpenersNotesSection(Spacer1)Details

(NonWLLink[WSInitialize(), paclet:ref/c/WSInitialize]) must be called before WSOpenArgcArgv().

WSOpenArgcArgv() processes the command-line arguments and uses them to control the creation of the link.

WSOpenArgcArgv() recognizes the following command-line arguments:

WSOpenArgcArgv() is not sensitive to the case of argument names.

WSOpenArgcArgv() ignores argument names that it does not recognize.

WSOpenArgcArgv() is called automatically by the (NonWLLink[WSMain(), paclet:ref/c/WSMain]) function created by (RefLink[wsprep, paclet:ref/program/wsprep]) and (RefLink[wscc, paclet:ref/program/wscc]).

On some computer systems, giving 0 for argc or a null pointer for argv will cause arguments to be requested interactively, typically through a dialog box.

WSOpenArgcArgv() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* create a link using command-line parameters */

int main(int argc, char **argv)
{
	WSENV env;
	WSLINK link;
	int error;

	env = WSInitialize((WSEnvironmentParameter)0);
	if(env == (WSENV)0)
		{ /* unable to initialize the WSTP environment */ }

	/* let WSOpenArgcArgv process the command line */
	link = WSOpenArgcArgv(env, argc, argv, &error);
	if(link == (WSLINK)0 || error != WSEOK)
		{ /* unable to create the link */ }

	/* ... */

	WSClose(link);
	WSDeinitialize(env);

	return 0;
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSActivate(), paclet:ref/c/WSActivate])  ▪  (NonWLLink[WSOpenString(), paclet:ref/c/WSOpenString])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}, {▪(RefLinkPlain[WSTP Connection Management, paclet:guide/WSTPConnectionManagement])}})}})