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

/* read a list of double-precision floating-point numbers from a link */

void f(MLINK lp)
    double *list;
    long length;

    if(! MLGetReal64List(lp, &list, &length))
            /* unable to read the list of numbers from lp */

    /* ... */

    MLDisownRealList(lp, list, length);