OpenersNotesSection(Spacer1)Details

The WSTP environment parameter object stores settings used to configure the WSTP environment object.

WSEnvironmentParameter is defined in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]), which should be included in the source code for any WSTP-compatible program.

WSEnvironmentParameter objects are created by the (NonWLLink[WSNewParameters(), paclet:ref/c/WSNewParameters]) function and deallocated by the (NonWLLink[WSReleaseParameters(), paclet:ref/c/WSReleaseParameters]) function.

WSEnvironmentParameters is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)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;
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSSetAllocParameter(), paclet:ref/c/WSSetAllocParameter])  ▪  (NonWLLink[WSSetThreadSafeLinksParameter(), paclet:ref/c/WSSetThreadSafeLinksParameter])  ▪  (NonWLLink[WSDoNotHandleSignalParameter(), paclet:ref/c/WSDoNotHandleSignalParameter])  ▪  (NonWLLink[WSReleaseParameters(), paclet:ref/c/WSReleaseParameters])  ▪  (NonWLLink[WSInitialize(), paclet:ref/c/WSInitialize])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Running the Wolfram System from within an External Program, paclet:tutorial/RunningTheWolframSystemFromWithinAnExternalProgram])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})