This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


int MLGetUCS2Symbol(MLINK link, const unsigned short **s, int *len)
gets a UCS-2 character string corresponding to the name of a symbol from the MathLink connection specified by link, storing the resulting string in s and length in len.
  • MLGetUCS2Symbol() allocates memory for the character string. You must call MLReleaseUCS2Symbol() to disown this memory. If MLGetUCS2Symbol() fails and the function's return value indicates an error, do not call MLReleaseUCS2Symbol() on the contents of s.
  • MLGetUCS2Symbol() returns immutable data.
  • MLGetUCS2Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetUCS2Symbol() fails.
  • MLGetUCS2Symbol() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* read a UCS-2 encoded symbol from a link */

void f(MLINK lp)
    const unsigned short *symbol;
    int len;

    if(! MLGetUCS2Symbol(lp, &symbol, &len))
            /* unable to retrieve the UCS-2 symbol */

    /* ... */

    MLReleaseUCS2Symbol(lp, symbol, len);