MLGetMessageHandler()

MLMessageHandlerObject MLGetMessageHandler(MLINK link)
returns the message handler function installed for the MLINK object link.

DetailsDetails

  • The urgent message handler function is called when MathLink receives an urgent message from the other end of the connection.
  • MLGetMessageHandler() returns (MLMessageHandlerObject)0 if link does not have an installed message handler function.
  • MLMessageHandlerObject is a pointer to a function of the form void f(MLINK link, int m1, int m2).
  • MLGetMessageHandler() is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

#include "mathlink.h"

/* a function to read MathLink urgent messages */

void AppMessageHandler(MLINK link, int m1, int m2)
{
    /* ... */
}


/* check that a link uses AppMessageHandler for urgent messages */

void check_the_message_handler(MLINK link)
{
    MLMessageHandlerObject handler;

    handler = MLGetMessageHandler(link);
    if(handler != (MLMessageHandlerObject)AppMessageHandler)
    {
        if(! MLSetMessageHandler(link, (MLMessageHandlerObject)AppMessageHandler))
            { /* unable to set AppMessageHandler as the handler for
             link */ }
    }
}
New to Mathematica? Find your learning path »
Have a question? Ask support »