WSInitialize (C Function)
WSENV WSInitialize(WSEnvironmentParameter p)
initializes the WSTP environment object and passes parameters in p.
Details
- 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.
Examples
Basic Examples (1)
#include "wstp.h"
int main(int argc, char **argv)
{
WSENV ep;
WSLINK lp;
int error;
ep = WSInitialize((WSEnvironmentParameter)0);
if(ep == (WSENV)0)
{ /* unable to initialize environment */ }
lp = WSOpenArgcArgv(ep, argc, argv, &error);
if(lp == (WSLINK)0 || error != WSEOK)
{ /* unable to create link */ }
/* ... */
WSClose(lp);
WSDeinitialize(ep);
return 0;
}