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


MLMessageHandlerObject MLGetMessageHandler(MLINK link)
returns the message handler function installed for the MLINK object link.
  • 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.
  • MLGetMessageHandler() is declared in the MathLink header file mathlink.h.
#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 */ }