WSNewParameters (C Function)

WSEnvironmentParameter WSNewParameters(unsigned long rev,unsigned long apirev)

allocates and initializes a WSEnvironmentParameter object and sets the WSTP revision number to the value specified by rev, and the WSTP API revision number to the value specified by apirev.


  • The WSTP revision number and the WSTP API revision number should be set to the constants WSREVISION and WSAPIREVISION from wstp.h.
  • WSNewParameters() allocates memory for the WSEnvironmentParameter object that must be released. Call WSReleaseParameters() to release the memory allocated by WSNewParameters().
  • WSNewParameters() returns NULL if an error occurs.
  • WSNewParameters() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include <stdlib.h>
#include "wstp.h"

/* initialize the WSTP environment */

WSENV f(void)
    WSENV env;
    WSEnvironmentParameter p;
    unsigned long res;

    if(p == (WSEnvironmentParameter)0)
    { /* Unable to initialize parameter object */ }

    WSSetAllocParameter(p, malloc, free);

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


    return env;