OpenersNotesSection(Spacer1)Details

The character string must be terminated with a null byte, corresponding to ∖0 in C.

MLPutSymbol() 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 MLPutSymbol() fails.

MLPutSymbol() 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 the expression Integrate[Sin[x],x] to a link */

void f(MLINK lp)
{
	if(! MLPutFunction(lp, "Integrate", 2))
		{ /* unable to put the function to lp */ }

	if(! MLPutFunction(lp, "Sin", 1))
		{ /* unable to put the function to lp */ }

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

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

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

	if(! MLFlush(lp))
		{ /* unable to flush any outgoing data buffered in lp */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLPutByteSymbol(), paclet:ref/c/MLPutByteSymbol])  ▪  (NonWLLink[MLPutUCS2Symbol(), paclet:ref/c/MLPutUCS2Symbol])  ▪  (NonWLLink[MLPutUTF8Symbol(), paclet:ref/c/MLPutUTF8Symbol])  ▪  (NonWLLink[MLPutUTF16Symbol(), paclet:ref/c/MLPutUTF16Symbol])  ▪  (NonWLLink[MLPutUTF32Symbol(), paclet:ref/c/MLPutUTF32Symbol])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}})}})