int WSGetLinksFromEnvironment( WSENV env , WSLINK ** links , int * l )

gets the list of currently open links in the WSTP environment env, and stores the list in links and the list length in l.


  • WSGetLinksFromEnvironment() allocates memory to store the list of links that must be released by calling WSReleaseLinksFromEnvironment(). If WSGetLinksFromEnvironment() returns an error, do not call WSReleaseLinksFromEnvironment() on the contents of links.
  • WSGetLinksFromEnvironment() returns 1 on success and 0 on failure.
  • WSGetLinksFromEnvironment() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include "wstp.h"

void examineTheLinks(WSENV env)
    WSLINK *theLinks;
    int length;
    int apiResult;

    apiResult = WSGetLinksFromEnvironment(env, &theLinks, &length);
    if(! apiResult)
    { /* Unable to retrieve the list of open links */ }

    /* ... */

    WSReleaseLinksFromEnvironment(env, theLinks, length);

See Also