Mathematica > Systems Interfaces & Deployment > C/C++ Language Interface > MathLink C Language Functions > MLGetInteger32List() >
Mathematica > Systems Interfaces & Deployment > MathLink API > MathLink C Language Functions > MLGetInteger32List() >

MLGetInteger32List()

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

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

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

    if(! MLGetInteger32List(lp, &data, &length))
        {
            /* unable to read the integer list from lp */
            return;
        }

    /* ... */

    MLReleaseInteger32List(lp, data, length);
}
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF