Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > MathLink C Language Functions >
MathLink C Function

MLActivate()

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 */
    if(!MLActivate(link))
{ /* unable to establish communication */ }

    /* ... */

    MLClose(link);
    MLDeinitialize(env);

    return 0;
}
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team