int MLEvaluate(MLINK link, char*string)
sends a string of input suitable for use with ToExpression[] to Mathematica for evaluation.


  • Unlike MLEvaluateString(), MLEvaluate() does not discard packets sent in response.
  • MLEvaluate() is only available for use in mprep MathLink template programs.
  • MLEvaluate() returns 0 on failure and a nonzero value on success.
  • MLEvaluate() is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

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

#include "mathlink.h"

/* read the Kernel's response to its evaluation of
{Date[], $TimeZone} */

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

    /* now read the Kernel's response */
        /* ... */

    /* ... */    
New to Mathematica? Find your learning path »
Have a question? Ask support »