Often, we are not concerned with the distinction between a scalar and array variable—all that is desired is a pointer to the data and to know how many elements there are. IDL_VarGetData() can be used to obtain this information:
void IDL_VarGetData(IDL_VPTR v, IDL_MEMINT *n, char **pd, int ensure_simple)
where:
v
The variable for which data is desired.
n
The address of a variable that will hold the number of elements.
pd
The address of variable that will hold a pointer to data, cast to be a pointer to a pointer to a character (for example (char **) &myptr).
ensure_simple
If TRUE, this routine calls the IDL_ENSURE_SIMPLE macro on the argument v to screen out variables of the types it prevents. Otherwise, IDL_EXCLUDE_FILE is called, because file variables have no data area to return.
On exit, IDL_VarGetData() stores the data count and pointer into the variables pointed at by n and pd, respectively.