This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function

MLClose()

void MLClose(MLINK link)
closes a MathLink connection.
  • Calling MLClose() does not necessarily terminate a program at the other end of the link.
  • Any data buffered in the link is sent when MLClose() is called.
  • Programs should close all links they have opened before terminating.
  • MLClose() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

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

    ep = MLInitialize((MLParametersPointer)0);
    if(ep (MLENV)0)
        { /* environment initialization failed */ }

    lp = MLOpenArgv(ep, argv, argv + argc, &error);
    if(lp (MLINK)0 || error MLEOK)
        { /* link creation failed */ }

    ...

    MLClose(lp);
    MLDeinitialize(ep);

    return 0;
}