MLGetUTF16Symbol (C Function)

MLGetUTF16Symbol has been replaced by WSGetUTF16Symbol.

int MLGetUTF16Symbol(MLINK link,const unsigned short **s,int *n,int *c)

gets a UTF-16 character string corresponding to the name of a symbol from the MathLink connection specified by link, storing the string in s, the length in n, and the number of characters in c.

Details

  • MLGetUTF16Symbol() allocates memory for the character string. You must call MLReleaseUTF16Symbol() to disown this memory. If MLGetUTF16Symbol() fails and the function's return value indicates an error, do not call MLReleaseUTF16Symbol() on the contents of s.
  • MLGetUTF16Symbol() returns immutable data.
  • MLGetUTF16Symbol() stores all characters directly in the UTF-16 Unicode encoding form.
  • The symbol s returned by MLGetUTF16Symbol() begins with a byte order mark.
  • The length of the symbol n includes the byte order mark.
  • MLGetUTF16Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetUTF16Symbol() fails.
  • MLGetUTF16Symbol() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* read a UTF-16 symbol from a link */

void f(MLINK lp)
{
    const unsigned short *symbol;
    int length;
    int characters;

    if(! MLGetUTF16Symbol(lp, &symbol, &length, &characters))
        {
            /* unable to read the UTF-16 symbol from lp */
            return;
        }

    /* ... */

    MLReleaseUTF16Symbol(lp, symbol, length, characters);
}