MLError has been replaced by WSError.

int MLError(MLINK link)

returns a value identifying the last error to occur on link. MLError() returns MLEOK if no error has occurred since the previous call to MLClearError().


  • You can get a textual description of errors by calling MLErrorMessage().
  • MLError() can return the following values:
  • MLEOKeverything is OK
    MLEDEADlink died
    MLEGBADinconsistent data read
    MLEGSEQMLGet() function called out of sequence
    MLEPBTKMLPutNext() passed a bad token
    MLEPSEQMLPut() function called out of sequence
    MLEPBIGMLPutData() given too much data
    MLEOVFLmachine number overflow
    MLEMEMout of memory
    MLEACCEPTfailure to accept socket connection
    MLECONNECTa deferred connection is still unconnected
    MLEPUTENDPACKETunexpected or missing call of MLEndPacket()
    MLENEXTPACKETMLNextPacket() called while the current packet has unread data
    MLEUNKNOWNPACKETMLNextPacket() read in an unknown packet head
    MLEGETENDPACKETunexpected end of packet
    MLEABORTa put or get was aborted before affecting the link
    MLECLOSEDthe other side of the link closed the connection (you may still receive undelivered data)
    MLEINITthe MathLink environment was not initialized
    MLEARGVinsufficient arguments to open the link
    MLEPROTOCOLprotocol unavailable
    MLEMODEmode unavailable
    MLELAUNCHlaunch unsupported
    MLELAUNCHAGAINcannot launch the program again from the same file
    MLELAUNCHSPACEinsufficient space to launch the program
    MLENOPARENTno parent available for connection
    MLENAMETAKENthe linkname was already in use
    MLENOLISTENthe linkname was found not to be listening
    MLEBADNAMEthe linkname was missing or not in the proper form
    MLEBADHOSTthe location was unreachable or not in the proper form
    MLELAUNCHFAILEDthe program failed to launch because a resource or library was missing
    MLELAUNCHNAMEthe launch failed because the program could not be found
    MLEPSCONVERTunable to convert from given character encoding to link encoding
    MLEGSCONVERTunable to convert from link encoding to requested encoding
    MLEPDATABADcharacter data in given encoding incorrect
    MLENOTEXEspecified file is not a MathLink executable
    MLESYNCOBJECTMAKEunable to create MathLink synchronization object
    MLEBACKOUTyield function terminated MathLink operation
    MLEBADOPTSYMunable to recognize symbol value on link
    MLEBADOPTSTRunable to recognize string value on link
    MLENEEDBIGGERBUFFERfunction call needs bigger buffer argument
  • MLError() is declared in the MathLink header file mathlink.h.


Basic Examples  (1)

#include "mathlink.h"

/* send the integer 10 to a link */

void f(MLINK lp)
    if(! MLPutInteger(lp, 10))
        /* check the possible errors */
            case MLEDEAD:
                /* the link died unexpectedly */
            case MLECLOSED:
                /* the other side closed the link */
            case MLEOK:
                /* no error occurred */
                /* ... */

See Also

MLErrorMessage()  MLClearError()