OpenersNotesSection(Spacer1)Details

The newly created link has an exact copy of the incoming and outgoing data streams of the parent link.

WSDuplicateLink() does not copy user data blocks.

Upon successful completion, WSDuplicateLink() returns a new link object and sets err to WSEOK.

In the event of an error, WSDuplicateLink() returns ((NonWLLink[WSLINK, paclet:ref/c/WSLINK]))0 and sets err to the appropriate value.

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

/* make a copy of a link */

WSLINK f(WSLINK lp)
{
	WSLINK newlink;
	int error;

	newlink = WSDuplicateLink(lp, (const char *)"Duplicate 1", &error);
	if(newlink == (WSLINK)0 || error != WSEOK)
		{ /* unable to create a copy of the link */ }

	return newlink;
}

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

({{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 Connection Management, paclet:guide/WSTPConnectionManagement])}})}})