MLEvaluate (C 函数)

MLEvaluate 已经被 WSEvaluate 所取代.

int MLEvaluate(MLINK link,char*string)

发送一个适于与 ToExpression[] 一起使用的输入字符串给 Wolfram 语言以便计算.

更多信息

  • 不像 MLEvaluateString()MLEvaluate() 将丢弃响应的数据包.
  • MLEvaluate() 只可用于 mprep MathLink 模板 程序.
  • MLEvaluate() 失败时返回0,成功时为非零值.
  • MLEvaluate() 在 MathLink 的标头文件 mathlink.h 中被声明.

范例

基本范例  (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))
    {
        /* ... */
    }

    /* ... */    
}