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 MLGetReal32Array(MLINK link, float **a, int **dims, char ***heads, int *d)
gets an array of single-precision 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 float 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.
  • MLGetReal32Array() allocates memory which must be disowned by calling MLReleaseReal32Array(). If MLGetReal32Array() fails and the function's return value indicates an error, do not call MLReleaseReal32Array() on the contents of a.
  • MLGetReal32Array() returns immutable data.
  • MLGetReal32Array() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetReal32Array() fails.
  • MLGetReal32Array() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

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

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

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

    /* ... */

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