WSGetUCS2Function()
This feature is not supported on the Wolfram Cloud.

int WSGetUSC2Function(WLINK l, const unsigned short **s, int *v, int *n)
gets a function with a symbol as a head encoded in the UCS2 encoding form from the WSTP connection specified by l, storing the name of the symbol in s, the length of the UCS2 codes in v, and the number of arguments of the function in n.

DetailsDetails

  • WSGetUCS2Function() allocates memory for the character string corresponding to the name of the head of the function. You must call WSReleaseUCS2Symbol() to disown this memory. If WSGetUCS2Function() fails and the function's return value indicates an error, do not call WSReleaseUCS2Symbol() on the contents of s.
  • Programs should not modify the contents of the character string s.
  • WSGetUCS2Function(l, &s, &v, &n) has the same effect as WSGetNext(l); WSGetArgCount(l, &n); WSGetUCS2Symbol(l, &s, &i).
  • WSGetUCS2Function() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetUCS2Function() fails.
  • WSGetUCS2Function() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* A function for reading a Mathematica function from a link */

void f(MLINK l)
{
    const unsigned short *s;
    int codes;
    int n;

    if(! WSGetUCS2Function(l, &s, &codes, &n))
    { /* Unable to read the function from the link */ }

    /* ... */

    WSReleaseUCS2Symbol(l, s, codes);
}