Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > MathLink C Language Functions >
MathLink C Function

MLGetSymbol()

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 */
            return;
        }

    /* ... */

    MLReleaseSymbol(lp, symbol);
}
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team