WSClose (C Function)

void WSClose(WSLINK link)

closes a WSTP connection.

Details

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

Examples

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 */ }

    ...

    WSClose(lp);
    WSDeinitialize(ep);

    return 0;
}