MLGetInteger32Array (C 函数)

MLGetInteger32Array 已经被 WSGetInteger32Array 所取代.

int MLGetInteger32Array(MLINK link,int **a,int **dims,char ***heads,int *d)

从由 link 指定的 MathLink 连接中获取一个32位整数数组,并把数组存于 a,维数存于 dims,深度存于 d.

更多信息

  • 数组 a 在内存中的布局像一个被声明为 的 C 数组.
  • heads 给出对应于出现在数组中的每层作为标头的符号名称的字符字符串列表.
  • MLGetInteger32Array() 分配必须调用 MLReleaseInteger32Array()来释放的内存. 如果 MLGetInteger32Array() 失败,函数的返回值表明一个错误,不要调用有 a 内容的 MLReleaseInteger32Array().
  • MLGetInteger32Array() 返回不可变的数据.
  • MLGetInteger32Array() 在错误事件中返回0,如果函数成功则返回非零值.
  • 如果 MLGetInteger32Array() 失败,则使用 MLError() 检索错误代码.
  • MLGetInteger32Array() 在 MathLink 的标头文件 mathlink.h 中被声明.

范例

基本范例  (1)

#include "mathlink.h"

/* read an array of 32-bit integers from a link */

void f(MLINK lp)
{
    int *data;
    int *dims;
    char **heads;
    int d;

    if(! MLGetInteger32Array(lp, &data, &dims, &heads, &d))
        {
            /* unable to read the array of integers from lp */
            return;
        }

    /* ... */

    MLReleaseInteger32Array(lp, data, dims, heads, d);
}