OpenersNotesSection(Spacer1)Details

After the call to WSPutUTF16Function(), other WSTP functions must be called to send the arguments of the function.

The function name s encoded in UTF-16 must start with a byte order mark.

The length of the symbol name s must include the byte order mark.

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

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

WSPutUTF16Function() 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 send List[1,2,3] to the link */

void f(WSLINK l)
{
	unsigned short name[5];

	name[0] = 0xFEFF;
	name[1] = 'L';
	name[2] = 'i';
	name[3] = 's';
	name[4] = 't';

	if(! WSPutUTF16Function(l, (unsigned short *)name, 5, 3))
	{ /* Unable to write the function head to the link */ }

	if(! WSPutInteger8(l, 1))
	{ /* Unable to write 1 to the link */ }

	if(! WSPutInteger8(l, 2))
	{ /* Unable to write 2 to the link */ }

	if(! WSPutInteger8(l, 3))
	{ /* Unable to write 3 to the link */ }

	if(! WSEndPacket(l))
	{ /* Unable to write the end-of-packet sequence to the link */ }

	if(! WSFlush(l))
	{ /* Unable to flush any outbound data from the link */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSPutFunction(), paclet:ref/c/WSPutFunction])  ▪  (NonWLLink[WSPutUCS2Function(), paclet:ref/c/WSPutUCS2Function])  ▪  (NonWLLink[WSPutUTF32Function(), paclet:ref/c/WSPutUTF32Function])  ▪  (NonWLLink[WSPutUTF8Function(), paclet:ref/c/WSPutUTF8Function])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}, {▪(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[C/C++ Language Interface, paclet:guide/CLanguageInterface])}, {▪(RefLinkPlain[Installable WSTP Programs, paclet:guide/InstallableWSTPPrograms])}, {▪(RefLinkPlain[WSTP API, paclet:guide/WSTPAPI])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Data, paclet:guide/WSTPCFunctionsForExchangingData])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Expressions, paclet:guide/WSTPCFunctionsForExchangingExpressions])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}, {▪(RefLinkPlain[WSTP Expression Packet Handling, paclet:guide/WSTPExpressionPacketHandling])}})}})