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 MLLoopbackOpen(MLENV env, int *errno)
opens a loopback MathLink connection.
  • In an external program set up with MathLink templates, the environment stdenv should be used.
  • You can use loopback links to effectively store Mathematica expressions.
  • Any expressions written to a loopback link can be read from the same link object.
  • MLLoopbackOpen() stores its error results in errno. If no error occurs errno contains MLEOK.
  • MLLoopbackOpen() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* read data from a link, store it in a loopback link, and return the loopback link */

MLINK f(MLENV env, MLINK link)
    MLINK loopbacklink;
    int error;

    loopbacklink = MLLoopbackOpen(env, &error);
    if(loopbacklink (MLINK)0 || error MLEOK)
        { /* unable to create loopbacklink */ }

    if(! MLTransferExpression(loopbacklink, link))
        { /* unable to transfer an expression from link to
loopbacklink */ }

    return loopbacklink;