MLActivate (C Function)

MLActivate has been replaced by WSActivate.

int MLActivate(MLINK link)

activates a MathLink connection, waiting for the program at the other end to respond.

Details

  • MLActivate() can be called only after one of the MLOpen functions such as 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.

Examples

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;
}