OpenersNotesSection(Spacer1)Details

MLErrorMessage() allocates memory for the message string that must be released. Use (NonWLLink[MLReleaseErrorMessage(), paclet:/ref/c/MLReleaseErrorMessage]) to release the memory allocated by MLErrorMessage(). If MLErrorMessage() returns NULL, do not call (NonWLLink[MLReleaseErrorMessage(), paclet:/ref/c/MLReleaseErrorMessage]) on the NULL value.

MLErrorMessage() 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 double precision floating-point number 3.22 to a link and print an error message if the send fails */

void f(MLINK lp)
{
	if(! MLPutReal64(lp, 3.22))
	{
		const char *message = MLErrorMessage(lp);

		/* unable to send 3.22 to lp */
		printf("MathLink Error: %s\n", message);

		MLReleaseErrorMessage(lp, message);
	}

	/* ... */
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLReleaseErrorMessage(), paclet:/ref/c/MLReleaseErrorMessage])  ▪  (NonWLLink[MLUCS2ErrorMessage(), paclet:/ref/c/MLUCS2ErrorMessage])  ▪  (NonWLLink[MLUTF16ErrorMessage(), paclet:/ref/c/MLUTF16ErrorMessage])  ▪  (NonWLLink[MLUTF32ErrorMessage(), paclet:/ref/c/MLUTF32ErrorMessage])  ▪  (NonWLLink[MLUTF8ErrorMessage(), paclet:/ref/c/MLUTF8ErrorMessage])  ▪  (NonWLLink[MLError(), paclet:ref/c/MLError])  ▪  (NonWLLink[MLClearError(), paclet:ref/c/MLClearError])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Error and Interrupt Handling, paclet:tutorial/ErrorAndInterruptHandling])}})}})