This feature is not supported on the Wolfram Cloud.

int WSActivate(WSLINK link)
activates a WSTP connection, waiting for the program at the other end to respond.


  • WSActivate() can be called only after one of the WSOpen functions such as WSOpenArgcArgv() or WSOpenString().
  • WSActivate() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSActivate() fails.
  • WSActivate() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* create a link and establish the connection */

int main(int argc, char **argv)
    WSENV env;
    WSLINK link;
    int error;

    env = WSInitialize((char *)0);
if(env == (WSENV)0)
{ /* unable to initialize the WSTP environment */ }

    /* let WSOpenArgcArgv process the command line */
    link = WSOpenArgcArgv(env, argc, argv, &error);
    if(link == (WSLINK)0 || error != WSEOK)
{ /* unable to create the link */ }

    /* WSActivate will establish the connection */
{ /* unable to establish communication */ }

    /* ... */


    return 0;