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 MLGetInteger16List(MLINK link, short **a, int *n)
gets a list of 16-bit integers from the MathLink connection specified by link, storing the integers in the array a and the length of the list in n.
  • MLGetInteger16List() allocates memory for the array of integers. You must call MLReleaseInteger16List() to disown this memory. If MLGetInteger16List() fails and the function's return value indicates an error, do not call MLReleaseInteger16List() on the contents of a.
  • MLGetInteger16List() returns immutable data.
  • MLGetInteger16List() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetInteger16List() fails.
  • MLGetInteger16List() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* read a list of 16-bit integers from a link */

void f(MLINK lp)
    short *data;
    int length;

    if(! MLGetInteger16List(lp, &data, &length))
            /* unable to read the integer list from lp */

    /* ... */

    MLReleaseInteger16List(lp, data, length);