OpenersNotesSection(Spacer1)Details

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

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

MLOpenArgcArgv() recognizes the following command-line arguments:

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

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

MLOpenArgcArgv() is called automatically by the (NonWLLink[MLMain(), paclet:ref/c/MLMain]) function created by (RefLink[mprep, paclet:ref/program/mprep]) and (RefLink[mcc, paclet:ref/program/mcc]).

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.

MLOpenArgcArgv() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

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

int main(int argc, char **argv)
{
	MLENV env;
	MLINK link;
	int error;

	env = MLInitialize((MLEnvironmentParameter)0);
	if(env == (MLENV)0)
		{ /* unable to initialize the MathLink environment */ }

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

	/* ... */

	MLClose(link);
	MLDeinitialize(env);

	return 0;
}

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