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 MLGetSymbol(MLINK link, const char **s)
gets a character string corresponding to the name of a symbol from the MathLink connection specified by link, storing the resulting string in s.
  • MLGetSymbol() allocates memory for the character string. You must call MLReleaseSymbol() to disown this memory. If MLGetSymbol() fails and the function's return value indicates an error, do not call MLReleaseSymbol() on the value contained in s.
  • MLGetSymbol() creates a string that is terminated by \0.
  • MLGetSymbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetSymbol() fails.
  • MLGetSymbol() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* read a symbol from a link */

void f(MLINK lp)
    const char *symbol;

    if(! MLGetSymbol(lp, &symbol))
            /* unable to read the symbol from lp */

    /* ... */

    MLReleaseSymbol(lp, symbol);