This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


int MLGetInteger16Array(MLINK link, short **a, int **dims, char ***heads, int *d)
gets an array of 16-bit integers from the MathLink connection specified by link, storing the array in a, its dimensions in dims and its depth in d.
  • The array a is laid out in memory like a C array declared as short a[m][n]....
  • heads gives a list of character strings corresponding to the names of symbols that appear as heads at each level in the array.
  • MLGetInteger16Array() allocates memory which must be disowned by calling MLReleaseInteger16Array(). If MLGetInteger16Array() fails the function's return value indicates an error, do not call MLReleaseInteger16Array() on the contents of a.
  • External programs should not modify the arrays generated by MLGetInteger16Array().
  • MLGetInteger16Array() returns immutable data.
  • MLGetInteger16Array() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetInteger16Array() fails.
  • MLGetInteger16Array() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

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

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

    if(! MLGetInteger16Array(lp, &data, &dims, &heads, &d))
            /* unable to read the integer array */

    /* ... */

    MLReleaseInteger16Array(lp, data, dims, heads, d);