MLInitialize()

MLInitialize has been replaced by WSInitialize.

MLENV MLInitialize(MLEnvironmentParameter p)

initializes the MathLink environment object and passes parameters in p.

Details

  • The MathLink environment object stores the global state of MathLink during the execution of a program.
  • A program can install custom memory allocators using the environment parameters object p.
  • An appropriate call to MLInitialize() is generated automatically when an external program is created from MathLink templates.
  • Any external program that uses the MathLink library must call MLInitialize() before calling any other link-related MathLink library functions.
  • The MathLink environment functions as a factory to create link objects.
  • MLInitialize() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

int main(int argc, char **argv)
{
    MLENV ep;
    MLINK lp;
    int error;

    ep = MLInitialize((MLEnvironmentParameter)0);
    if(ep == (MLENV)0)
        { /* unable to initialize environment */ }

    lp = MLOpenArgcArgv(ep, argc, argv, &error);
    if(lp == (MLINK)0 || error != MLEOK)
        { /* unable to create link */ }

    /* ... */

    MLClose(lp);
    MLDeinitialize(ep);
    return 0;
}

See Also

MLNewParameters()  MLSetAllocParameter()

Tutorials