MLGetRealArray has been replaced by WSGetRealArray.

int MLGetRealArray(MLINK link,double **a,long **dims,char ***heads,long *d)

gets an array of floating-point numbers 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 .
  • heads gives a list of character strings corresponding to the names of symbols that appear as heads at each level in the array.
  • MLGetRealArray() allocates memory which must be released by calling MLDisownRealArray(). If MLGetRealArray() fails and the function's return value indicates an error, do not call MLReleaseRealArray() on the contents of a.
  • MLGetRealArray() returns immutable data.
  • MLGetRealArray() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetRealArray() fails.
  • MLGetRealArray() is equivalent to MLGetReal64Array().


Basic Examples  (1)

#include "mathlink.h"

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

void f(MLINK lp)
    double *data;
    long *dims;
    char **heads;
    long d; /* stores the rank of the array */

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

    /* ... */

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