This feature is not supported on the Wolfram Cloud.

WSLINK WSLoopbackOpen(WSENV env,int *errno)
opens a loopback WSTP connection.


  • In an external program set up with WSTP templates, the environment stdenv should be used.
  • You can use loopback links to effectively store Wolfram Language expressions.
  • Any expressions written to a loopback link can be read from the same link object.
  • WSLoopbackOpen() stores its error results in errno. If no error occurs errno contains WSEOK.
  • WSLoopbackOpen() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

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

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

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

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

    return loopbacklink;    
Translate this page: