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


int MLActivate(MLINK link)
activates a MathLink connection, waiting for the program at the other end to respond.
  • 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.
#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 */
{ /* unable to establish communication */ }

    /* ... */


    return 0;