MLEvaluate()

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

DetailsDetails

  • 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)

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

#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 */
    switch(MLGetType(stdlink))
    {
        /* ... */
    }

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