WSLoopbackOpen (C Function)

WSLINK WSLoopbackOpen(WSENV env,int *errno)

opens a loopback WSTP connection.

Details

  • 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.

Examples

Basic Examples  (1)

#include "wstp.h"

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

WSLINK f(WSENV env, WSLINK link)
{
    WSLINK loopbacklink;
    int error;

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

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

    return loopbacklink;    
}