WSENV (C Function)

is a WSTP type representing a WSTP library environment.

Details

  • The WSTP environment object stores the global state of WSTP during the execution of a program.
  • WSENV is defined in the file wstp.h, which should be included in the source code for any WSTP-compatible program.
  • WSENV objects are created by the WSInitialize() function and deallocated by the WSDeinitialize() function.
  • Each WSTP program must create a WSENV object before accessing any other WSTP functionality.
  • WSENV is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

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

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

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

    /* ... */

    WSClose(link);
    WSDeinitialize(env);
    return 0;
}