WSGetSymbol()
This feature is not supported on the Wolfram Cloud.

int WSGetSymbol(WSLINK link,const char **s)
gets a character string corresponding to the name of a symbol from the WSTP connection specified by link, storing the resulting string in s.

DetailsDetails

  • WSGetSymbol() allocates memory for the character string. You must call WSReleaseSymbol() to disown this memory. If WSGetSymbol() fails and the function's return value indicates an error, do not call WSReleaseSymbol() on the value contained in s.
  • WSGetSymbol() creates a string that is terminated by 0.
  • WSGetSymbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetSymbol() fails.
  • WSGetSymbol() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* read a symbol from a link */

void f(MLINK lp)
{
    const char *symbol;

    if(! WSGetSymbol(lp, &symbol))
        {
            /* unable to read the symbol from lp */
            return;
        }

    /* ... */

    WSReleaseSymbol(lp, symbol);
}