MLGetMessage (C Function)

MLGetMessage has been replaced by WSGetMessage.

int MLGetMessage(MLINK link,int* code,int*param)

reads an out-of-band message code from the urgent message channel associated with link and stores the code in code and any parameter in param.

Details

  • MLGetMessage() returns a nonzero value if it reads an out-of-band message and 0 otherwise.
  • MLGetMessage() is a nonblocking function.
  • MLGetMessage() can return the following messages:
  • MLTerminateMessageshut down the current program
    MLInterruptMessageinterrupt the current operation
    MLAbortMessageabort the current operation
    MLEndPacketMessageobsolete message
    MLSynchronizeMessagesynchronize the internal expression streams for both sides of the link
    MLImDyingMessageother side of the link is shutting down
    MLWaitingAcknowledgementother side of the link needs a response
    MLMarkTopLevelMessageMathLink library internal message
    MLLinkClosingMessageMathLink library internal message
    MLAuthenticationFailurefailure to authenticate message
    MLFirstUserMessagebeginning of user-defined message space
    MLLastUserMessageend of user-defined message space
  • MLFirstUserMessage should be used as the starting value for any user-defined messages. You could define a new message as #define MyAppMessage MLFirstUserMessage + 1.
  • User-defined messages should not have values larger than MLLastUserMessage.
  • Standard MathLink messages do not have any parameters.
  • MLGetMessage() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* read an out-of-band message code from a link */

void f(MLINK lp)
{
    int code, param;

    if(MLMessageReady(lp))
    {
        if(! MLGetMessage(lp, &code, &param))
            { /* unable to read the message code from lp */ }
    }
}