OpenersNotesSection(Spacer1)Details

The array a is laid out in memory like a C array declared as double 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.

WSGetRealArray() allocates memory which must be released by calling WSDisownRealArray(). If WSGetRealArray() fails and the function's return value indicates an error, do not call WSReleaseRealArray() on the contents of a.

WSGetRealArray() returns immutable data.

WSGetRealArray() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[WSError(), paclet:ref/c/WSError]) to retrieve the error code if WSGetRealArray() fails.

WSGetRealArray() is equivalent to (NonWLLink[WSGetReal64Array(), paclet:ref/c/WSGetReal64Array]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

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

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

	if(! WSGetRealArray(lp, &data, &dims, &heads, &d))
		{
			/* unable to read the array from lp */
			return;
		}

	/* ... */

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

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Data, paclet:guide/WSTPCFunctionsForExchangingData])}})}})