MLMessageHandlerObject
This feature is not supported on the Wolfram Cloud.

has been replaced by .


is a MathLink type that describes a function pointer to a function taking three arguments: an MLINK, an int, and an int, and returning a void that implements an urgent message handler.

DetailsDetails

  • The urgent message handler function is called when MathLink receives an urgent message from the other end of the connection.
  • MLMessageHandlerObject is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "mathlink.h"


/* handle three common MathLink urgent messages */

void f(MLINK lp, int msg, int arg)
{
    if(msg == MLInterruptMessage)
        { /* generate an interrupt menu */ }
    else if(msg == MLAbortMessage)
        { /* abort the current operation */ }
    else if(msg == MLTerminateMessage)
        { /* shutdown the program */ }

    /* ... */
}


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

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

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

    if(! MLSetMessageHandler(link, (MLMessageHandlerObject)f)
        { /* unable to install message handler for link */ }

    /* ... */

    MLClose(link);
    MLDeinitialize(env);

    return 0;
}