WSDuplicateLink (C Function)

WSLINK WSDuplicateLink(WSLINK parent,const char *name,int *err)

returns a copy of parent and sets the new link object's name to name.

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 (WSLINK)0 and sets err to the appropriate value.
  • WSDuplicateLink() is declared in the WSTP header file wstp.h.

Examples

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;
}