Mathematica > Systems Interfaces & Deployment > C/C++ Language Interface > MathLink C Language Functions >
Mathematica > Systems Interfaces & Deployment > MathLink API > MathLink C Language Functions >
MathLink C Function

MLEvaluate()

int MLEvaluate(MLINK link, char*string)
sends a string of input suitable for use with ToExpression[] to Mathematica for evaluation.
  • 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.
: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))
    {
        /* ... */
    }

    /* ... */    
}
© 2008 Wolfram Research, Inc.
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team