WSActivate()
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.

DetailsDetails

  • 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)
{
    MLENV env;
    MLINK link;
    int error;

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

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

    /* WSActivate will establish the connection */
    if(!WSActivate(link))
{ /* unable to establish communication */ }

    /* ... */

    WSClose(link);
    WSDeinitialize(env);

    return 0;
}