WSEvaluate (C Function)

int WSEvaluate(WSLINK link,char*string)

sends a string of input suitable for use with ToExpression[] to the Wolfram Language for evaluation.


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


Basic Examples  (1)

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

#include "wstp.h"

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

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

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

    /* ... */