WSEvaluateString (C Function)
int WSEvaluateString(WSLINK link,char *string)
sends a string to the Wolfram Language for evaluation, and discards any packets sent in response.
Details
- The code for WSEvaluateString() is not included in the WSTP library, but is generated automatically by mcc or mprep in processing WSTP template files.
- will cause to be printed in a Wolfram System session at the other end of the link.
- WSEvaluateString() is only available for use in mprep WSTP template programs.
- WSEvaluateString() returns 0 on failure and a nonzero value on success.
- WSEvaluateString() is declared in the WSTP header file wstp.h.
Examples
Basic Examples (1)
:Begin:
:Function: f
:Pattern: KernelTime[]
:Arguments: {}
:ArgumentTypes: Manual
:ReturnType: Manual
:End:
#include "wstp.h"
/* read the Kernel's response from evaluating the expression
{Date[],$TimeZone} */
void f(void)
{
/* Pretend we are not in our local timezone. */
if(! WSEvaluateString(stdlink, "$TimeZone = 9;"))
{ /* unable to send $TimeZone = 9; to stdlink */ }
if(! WSEvaluate(stdlink, "{Date[],$TimeZone}"))
{ /* unable to send the expression to stdlink */ }
/* get the Kernel's response */
switch(WSGetType(stdlink))
{
/* ... */
}
/* ... */
}