MLGetSymbol (C Function)

MLGetSymbol has been replaced by WSGetSymbol.

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.

Details

  • 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.

Examples

Basic Examples  (1)

#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);
}