WSGetUTF16Function (C Function)

int WSGetUTF16Function( WSLINK l , const unsigned short * s , int * v , int * n )

gets a function with a symbol as a head encoded in the UTF-16 encoding form from the WSTP connection specified by l, storing the name of the symbol in s, the length of the UTF-16 codes in v, and the number of arguments to the function in n.


  • WSGetUTF16Function() allocates memory for the character string corresponding to the name of the head of the function. You must call WSReleaseUTF16Symbol() to disown this memory. If WSGetUTF16Function() fails and the function's return value indicates an error, do not call WSReleaseUTF16Symbol() on the contents of s.
  • Programs should not modify the contents of the character string s.
  • The character string returned by WSGetUTF16Function() begins with a platform-appropriate byte order mark. This byte order mark is included in the length value v.
  • WSGetUTF16Function(l, &s, &v, &n) has the same effect as WSGetNext(l); WSGetArgCount(l, &n); WSGetUTF16Symbol(l, &s, &v, &c), where c is the number of characters encoded in s.
  • WSGetUTF16Function() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetUTF16Function() fails.
  • WSGetUTF16Function() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include "wstp.h"

/* read a function from a link */

void f(WSLINK l)
    const unsigned short *s;
    int length;
    int n;

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

    /* ... */

    WSReleaseUTF16Symbol(l, s, length);