WSUTF16LinkName (C Function)

const unsigned short * WSUTF16LinkName(WSLINK l, int *n)

returns the a string of length n encoded in the UTF-16 encoding form representing the name of the WSTP connection specified by l.


  • WSUTF16LinkName() allocates memory for the link name string that must be released. To release the memory, call WSReleaseUTF16LinkName() on the value returned by the function. If WSUTF16LinkName() returns NULL, do not call WSReleaseUTF16LinkName() on the NULL value.
  • Programs should not modify the contents of the string returned by WSUTF16LinkName().
  • The link name string returned by WSUTF16LinkName() contains a byte order mark.
  • The link name length n includes the byte order mark.
  • WSTP links are created using a combination of link mode, link protocol, and other options. The link name provides necessary information for the link mode and link protocol used to create the link.
  • WSUTF16LinkName() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include "wstp.h"

/* A function for reading the name of a link */

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

    name = WSUTF16LinkName(l, &length);

    /* We check length <= 1 because WSUTF16LinkName returns a string
    with a byte order mark. */

    if(name == (const unsigned short *)0 || length <= 1)
    { /* Unable to read the link name */ }

    /* ... */

    WSReleaseUTF16LinkName(l, name, length);