MLGetFunction has been replaced by WSGetFunction.

int MLGetFunction(MLINK link,const char **s,int *n)

gets a function with a symbol as a head from the MathLink connection specified by link, storing the name of the symbol in s and the number of arguments of the function in n.


  • MLGetFunction() allocates memory for the character string corresponding to the name of the head of the function. You must call MLReleaseSymbol() to disown this memory. If MLGetFunction() fails and the function's return value indicates an error, do not call MLReleaseSymbol() on the contents of s.
  • External programs should not modify the character string s.
  • has the same effect as MLGetNext(link);MLGetArgCount(link,&n);MLGetSymbol(link,&s).
  • MLGetFunction() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetFunction() fails.
  • MLGetFunction() is declared in the MathLink header file mathlink.h.


Basic Examples  (1)

#include "mathlink.h"

/* read a Mathematica function from a link */

void f(MLINK lp)
    const char *f;
    int n;

    if(! MLGetFunction(lp, &f, &n))
            /* unable to read the function from lp */

    /* ... */

    MLReleaseSymbol(lp, f);

See Also

MLReleaseSymbol()  MLGetNext()