This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
MathLink C Function


int MLGetArgCount(MLINK link, int *n)
finds the number of arguments to a function on link and stores the result in n.
  • MLGetArgCount() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* check a link for a function and return the number of arguments */

int f(MLINK lp)
    int a;

        case MLTKFUNC:
            /* get the argument size */
            if(! MLGetArgCount(lp, &a))
                { /* unable to get the number of arguments from lp */ }
            return a;
            /* ... */

    /* ... */