WSInitialize()
This feature is not supported on the Wolfram Cloud.

WSENV
initializes the WSTP environment object and passes parameters in p.

DetailsDetails

  • The WSTP environment object stores the global state of WSTP during the execution of a program.
  • A program can install custom memory allocators using the environment parameters object p.
  • An appropriate call to WSInitialize() is generated automatically when an external program is created from WSTP templates.
  • Any external program that uses the WSTP library must call WSInitialize() before calling any other link-related WSTP library functions.
  • The WSTP environment functions as a factory to create link objects.
  • WSInitialize() 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;
    MLINK lp;
    int error;

    ep = WSInitialize((WSEnvironmentParameter)0);
    if(ep == (MLENV)0)
        { /* unable to initialize environment */ }

    lp = WSOpenArgcArgv(ep, argc, argv, &error);
    if(lp == (MLINK)0 || error != WSEOK)
        { /* unable to create link */ }

    /* ... */

    WSClose(lp);
    WSDeinitialize(ep);
    return 0;
}