OpenersNotesSection(Spacer1)Details

dst and src need not be distinct.

dst and src can be either loopback or ordinary links.

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

WSTransferExpression() is often used to read an expression from a link in order to store it in a loopback link.

WSTransferExpression() is passed (WSLINK)0 for dst, the expression on src will be discarded.

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

/* transfer an expression to link 2 from loopback link 1 */

void f(WSLINK lp2, WSLINK lp1)
{
	/* send EvaluatePacket[ToExpression[str]] to lp1 */
    if(! WSPutFunction(lp1, "EvaluatePacket", 1))
		{ /* unable to put function to lp1 */ }

	if(! WSPutFunction(lp1, "ToExpression", 1))
		{ /* unable to put function to lp1 */ }

	if(! WSPutString(lp1, "a = Table[RandomInteger[2,12]];"))
		{ /* unable to put the string to lp1 */ }

	if(! WSEndPacket(lp1))
		{ /* unable to put the end-of-packet indicator to lp1 */ }

	if(! WSFlush(lp1))
		{ /* unable to put flush any outgoing data buffered in lp1 */ }

    /* now transfer to lp2 from lp1 */
	if(! WSTransferExpression(lp2, lp1))
		{ /* unable to transfer an expression from lp1 to lp2 */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSTransferToEndOfLoopbackLink(), paclet:ref/c/WSTransferToEndOfLoopbackLink])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(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 API, paclet:guide/WSTPAPI])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Expressions, paclet:guide/WSTPCFunctionsForExchangingExpressions])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}})}})