This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


MLINK MLDuplicateLink(MLINK parent, const char *name, int *err)
returns a copy of parent and sets the new link object's name to name.
  • The newly created link has an exact copy of the incoming and outgoing data streams of the parent link.
  • MLDuplicateLink() does not copy user data blocks.
  • Upon successful completion, MLDuplicateLink() returns a new link object and sets err to MLEOK.
  • In the event of an error, MLDuplicateLink() returns (MLINK)0 and sets err to the appropriate value.
  • MLDuplicateLink() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* make a copy of a link */

    MLINK newlink;
    int error;

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

    return newlink;