WSEnvironmentParameter (C Function)

is a WSTP type representing a WSTP library environment parameter set.

Details

  • The WSTP environment parameter object stores settings used to configure the WSTP environment object.
  • WSEnvironmentParameter is defined in the WSTP header file wstp.h, which should be included in the source code for any WSTP-compatible program.
  • WSEnvironmentParameter objects are created by the WSNewParameters() function and deallocated by the WSReleaseParameters() function.
  • WSEnvironmentParameters is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"


void * Custom_Allocator(size_t size)
{
    /* ... */
}

void Custom_Deallocator(void *ptr)
{
    /* ... */
}


int main()
{
    WSEnvironmentParameter ep;
    WSENV env;
    
    ep = WSNewParameters(WSREVISION, WSAPIREVISION);
    if(ep == (WSEnvironmentParameter)0)
    { /* Unable to initialize WSEnvironmentParameter object */ }

    WSSetAllocParameter(ep, Custom_Allocator, Custom_Deallocator);

    /* Give the WSTP library the custom memory allocator */
    env = WSInitialize(ep);
    if(env == (WSENV)0)
    { /* Unable to initialize the WSTP environment */ }

    WSReleaseParameters(ep);

    /* ... */

    WSDeinitialize(env);

    return 0;
}