MLENV (C Function)

MLENV has been replaced by WSENV.

is a MathLink type representing a MathLink library environment.


  • The MathLink environment object stores the global state of MathLink during the execution of a program.
  • MLENV is defined in the file mathlink.h, which should be included in the source code for any MathLink-compatible program.
  • MLENV objects are created by the MLInitialize() function and deallocated by the MLDeinitialize() function.
  • Each MathLink program must create a MLENV object before accessing any other MathLink functionality.
  • MLENV is declared in the MathLink header file mathlink.h.


Basic Examples  (1)

#include "mathlink.h"

int main(int argc, char **argv)
    MLENV env;
    MLINK link;
    int error;

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

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

    /* ... */

    return 0;