OpenersNotesSection(Spacer1)Details

MLPutArgCount() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[MLError(), paclet:ref/c/MLError]) to retrieve the error code if MLPutArgCount() fails.

MLPutArgCount() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* send Plus[2,3] over a link */

void f(MLINK lp)
{
	if(! MLPutType(lp, MLTKFUNC))
		{ /* unable to send the function type to lp */ }

	if(! MLPutArgCount(lp, 2))
		{ /* unable to put the number of arguments to lp */ }

	if(! MLPutSymbol(lp, "Plus"))
		{ /* unable to put the symbol to lp */ }

	if(! MLPutInteger(lp, 2))
		{ /* unable to put the integer to lp */ }

	if(! MLPutInteger(lp, 3))
		{ /* unable to put the integer to lp */ }

	if(! MLEndPacket(lp))
		{ /* unable to send the end-of-packet indicator */ }

	if(! MLFlush(lp))
		{ /* unable to flush the link-output buffer */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLPutType(), paclet:ref/c/MLPutType])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}})}})