#include "mathlink.h"
void * Custom_Allocator(size_t size)
{
/* ... */
}
void Custom_Deallocator(void *ptr)
{
/* ... */
}
int main()
{
MLEnvironment env;
MLParameters p;
unsigned long revision;
revision = MLNewParameters((char *)&p, MLREVISION, MLAPIREVISION);
if(! revision)
{ /* unable to initialize the MLParameters object */ }
MLSetAllocParameter(&p, Custom_Allocator, Custom_Deallocator);
/* Install the Custom* memory allocator in MathLink. */
env = MLInitialize(&p);
if(env == (MLENV)0)
{ /* unable to initialize MathLink environment */ }
/* ... */
MLDeinitialize(env);
return 0;
}