MLEvaluateString (C Function)

MLEvaluateString has been replaced by WSEvaluateString.

int MLEvaluateString(MLINK link,char *string)

sends a string to the Wolfram Language for evaluation, and discards any packets sent in response.


  • The code for MLEvaluateString() is not included in the MathLink library, but is generated automatically by mcc or mprep in processing MathLink template files.
  • will cause to be printed in a Wolfram System session at the other end of the link.
  • MLEvaluateString() is only available for use in mprep MathLink template programs.
  • MLEvaluateString() returns 0 on failure and a nonzero value on success.
  • MLEvaluateString() is declared in the MathLink header file mathlink.h.


Basic Examples  (1)

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

#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 */
        /* ... */

    /* ... */