WSGetInteger64Array (C Function)

int WSGetInteger64Array(WSLINK link,wsint64 **a,int **dims,char ***heads,int *d)

gets an array of native 64-bit integers from the WSTP connection specified by link, storing the array in a, its dimensions in dims, and its depth in d.

Details

  • The array a is laid out in memory like a C array declared as wsint64 .
  • heads gives a list of character strings corresponding to the names of symbols that appear as heads at each level in the array.
  • WSGetInteger64Array() allocates memory which must be disowned by calling WSReleaseInteger64Array(). If WSGetInteger64Array() fails and the function's return value indicates an error, do not call WSReleaseInteger64Array() on the contents of a.
  • WSGetInteger64Array() returns immutable data.
  • WSGetInteger64Array() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetInteger64Array() fails.
  • WSGetInteger64Array() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* read an array of 64-bit integers from a link */

void f(WSLINK lp)
{
    wsint64 *data;
    int *dims;
    char **heads;
    int d;

    if(! WSGetInteger64Array(lp, &data, &dims, &heads, &d))
        {
            /* unable to get the array of 64-bit integers from lp */
            return;
        }

    /* ... */

    WSReleaseInteger64Array(lp, data, dims, heads, d);
}