MLActivate()

int MLActivate(MLINK link)
activates a MathLink connection, waiting for the program at the other end to respond.

DetailsDetails

  • MLActivate() can be called only after MLOpenArgcArgv() or MLOpenString().
  • MLActivate() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLActivate() fails.
  • MLActivate() is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

#include "mathlink.h"

/* create a link and establish the connection */

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

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

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

    /* MLActivate will establish the connection */
    if(!MLActivate(link))
{ /* unable to establish communication */ }

    /* ... */

    MLClose(link);
    MLDeinitialize(env);

    return 0;
}
New to Mathematica? Find your learning path »
Have a question? Ask support »