WSGetReal64Array (C Function)

int WSGetReal64Array(WSLINK link,double **a,int** dims,char ***heads,int *d)

gets an array of double-precision floating-point numbers from the WSTP 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.
  • WSGetReal64Array() allocates memory which must be released by calling WSReleaseReal64Array(). If WSGetReal64Array() fails and the function's return value indicates an error, do not call WSReleaseReal64Array()on the contents of a.
  • WSGetReal64Array() returns immutable data.
  • WSGetReal64Array() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetReal64Array() fails.
  • WSGetReal64Array() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include "wstp.h"

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

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

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

    /* ... */

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