This feature is not supported on the Wolfram Cloud.

void WSClose(WSLINK link)
closes a WSTP connection.


  • Calling WSClose() does not necessarily terminate a program at the other end of the link.
  • Any data buffered in the link is sent when WSClose() is called.
  • Programs should close all links they have opened before terminating.
  • WSClose() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

int main(int argc, char **argv)
    WSENV ep;
    WSLINK lp;
    int error;

    ep = WSInitialize((WSParametersPointer)0);
    if(ep == (WSENV)0)
        { /* environment initialization failed */ }

    lp = WSOpenArgv(ep, argv, argv + argc, &error);
    if(lp == (WSLINK)0 || error != WSEOK)
        { /* link creation failed */ }



    return 0;
Translate this page: