OpenersNotesSection(Spacer1)Details

The MathLink revision number and the MathLink API revision number should be set to the constants MLREVISION and MLAPIREVISION from (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

MLNewParameters() allocates memory for the (NonWLLink[MLEnvironmentParameter, paclet:/ref/c/MLEnvironmentParameter]) object that must be released. Call (NonWLLink[MLReleaseParameters(), paclet:/ref/c/MLReleaseParameters]) to release the memory allocated by MLNewParameters().

MLNewParameters() returns NULL if an error occurs.

MLNewParameters() 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 <stdlib.h>
#include "mathlink.h"

/* initialize the MathLink environment */

MLENV f(void)
{
	MLENV env;
	MLEnvironmentParameter p;
	unsigned long res;

	p = MLNewParameters(MLREVISION, MLAPIREVISION);
	if(p == (MLEnvironmentParameter)0)
	{ /* Unable to initialize parameter object */ }

	MLSetAllocParameter(p, malloc, free);

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

	MLReleaseParameters(p);

	return env;
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLReleaseParameters(), paclet:ref/c/MLReleaseParameters])  ▪  (NonWLLink[MLSetAllocParameter(), paclet:ref/c/MLSetAllocParameter])  ▪  (NonWLLink[MLAllocParameter(), paclet:ref/c/MLAllocParameter])}})}})