OpenersNotesSection(Spacer1)Details

The code for MLEvaluateString() is not included in the MathLink library, but is generated automatically by (RefLink[mcc, paclet:ref/program/mcc]) or (RefLink[mprep, paclet:ref/program/mprep]) in processing MathLink template files.

MLEvaluateString(lp,"Print[∖"string∖"]") will cause string to be printed in a Wolfram System session at the other end of the link.

MLEvaluateString() is only available for use in (RefLink[mprep, paclet:ref/program/mprep]) MathLink template programs.

MLEvaluateString() returns 0 on failure and a nonzero value on success.

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

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

:Begin:
:Function: f
:Pattern: KernelTime[]
:Arguments: {}
:ArgumentTypes: Manual
:ReturnType: Manual
:End:

#include "mathlink.h"

/* read the Kernel's response from evaluating the expression
   {Date[],$TimeZone} */

void f(void)
{
	/* Pretend we are not in our local timezone. */
	if(! MLEvaluateString(stdlink, "$TimeZone = 9;"))
		{ /* unable to send $TimeZone = 9; to stdlink */ }

	if(! MLEvaluate(stdlink, "{Date[],$TimeZone}"))
		{ /* unable to send the expression to stdlink */ }

	/* get the Kernel's response */
	switch(MLGetType(stdlink))
	{
		/* ... */
	}

	/* ... */	
}

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

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Two-Way Communication with External Programs, paclet:tutorial/TwoWayCommunicationWithExternalPrograms])}, {▪(RefLinkPlain[Setting Up External Functions to Be Called from the Wolfram Language, paclet:tutorial/SettingUpExternalFunctionsToBeCalledFromTheWolframLanguage])}})}})