OpenersNotesSection(Spacer1)Details

The memory used to contain the message m must have been allocated by a call to (NonWLLink[WSUTF16ErrorMessage(), paclet:ref/c/WSUTF16ErrorMessage]).

WSReleaseUTF16ErrorMessage() 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"

/* A function to retrieve the error message from a link */

void f(WSLINK l)
{
	const unsigned short *message;
	int length;

	message = WSUTF16ErrorMessage(l, &length);

	/* We test for length <= 1 because WSUTF16Error message
	returns a string that begins with a byte order mark */

	if(message == (const unsigned short *)0 || length <= 1)
	{ /* Unable to retrieve the error message from the link */ }

	/* ... */

	WSReleaseUTF16ErrorMessage(l, message, length);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSUTF16ErrorMessage(), paclet:ref/c/WSUTF16ErrorMessage])  ▪  (NonWLLink[WSReleaseErrorMessage(), paclet:ref/c/WSReleaseErrorMessage])  ▪  (NonWLLink[WSReleaseUCS2ErrorMessage(), paclet:ref/c/WSReleaseUCS2ErrorMessage])  ▪  (NonWLLink[WSReleaseUTF32ErrorMessage(), paclet:ref/c/WSReleaseUTF32ErrorMessage])  ▪  (NonWLLink[WSReleaseUTF8ErrorMessage(), paclet:ref/c/WSReleaseUTF8ErrorMessage])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(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[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}})}})