MLNewParameters (C Function)

MLNewParameters has been replaced by WSNewParameters.

MLEnvironmentParameter MLNewParameters(unsigned long rev,unsigned long apirev)

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

Details

  • The MathLink revision number and the MathLink API revision number should be set to the constants MLREVISION and MLAPIREVISION from mathlink.h.
  • MLNewParameters() allocates memory for the MLEnvironmentParameter object that must be released. Call MLReleaseParameters() to release the memory allocated by MLNewParameters().
  • MLNewParameters() returns NULL if an error occurs.
  • MLNewParameters() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

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

/* initialize the MathLink environment */

MLENV f(void)
{
    MLENV env;
    MLEnvironmentParameter p;
    unsigned long res;

    p = MLNewParameters(MLREVISION, MLAPIREVISION);
    if(p == (MLEnvironmentParameter)0)
    { /* Unable to initialize parameter object */ }

    MLSetAllocParameter(p, malloc, free);

    env = MLInitialize(p);
    if(env == (MLENV)0)
    { /* Unable to initialize the MathLink environment */ }

    MLReleaseParameters(p);

    return env;
}