OpenersNotesSection(Spacer1)Details

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

WSErrorMessage() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* send the double precision floating-point number 3.22 to a link and print an error message if the send fails */

void f(WSLINK lp)
{
	if(! WSPutReal64(lp, 3.22))
	{
		const char *message = WSErrorMessage(lp);

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

		WSReleaseErrorMessage(lp, message);
	}

	/* ... */
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSReleaseErrorMessage(), paclet:ref/c/WSReleaseErrorMessage])  ▪  (NonWLLink[WSUCS2ErrorMessage(), paclet:ref/c/WSUCS2ErrorMessage])  ▪  (NonWLLink[WSUTF16ErrorMessage(), paclet:ref/c/WSUTF16ErrorMessage])  ▪  (NonWLLink[WSUTF32ErrorMessage(), paclet:ref/c/WSUTF32ErrorMessage])  ▪  (NonWLLink[WSUTF8ErrorMessage(), paclet:ref/c/WSUTF8ErrorMessage])  ▪  (NonWLLink[WSError(), paclet:ref/c/WSError])  ▪  (NonWLLink[WSClearError(), paclet:ref/c/WSClearError])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Error and Interrupt Handling, paclet:tutorial/ErrorAndInterruptHandling])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[Low-Level WSTP Operations, paclet:guide/LowLevelWSTPOperations])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}})}})