handle error output in OpenMaple - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Programming : OpenMaple : VB Application Programming Interface : Session State and Input-Output Functions : OpenMaple/VB/errorCallBack

errorCallBack - handle error output in OpenMaple

Calling Sequence

errorCallBack(data, offset, msg)




user_data pointer passed to StartMaple (Long)






error message (byte array pointer)



This OpenMaple function is part of the MapleCallBack structure passed as an argument to StartMaple.


The errorCallBack function is called when an error occurs during parsing or processing.


The prototype for the function you can assign to the entry in the MapleCallBack must look like the following.

Sub ErrorCallBack(ByVal data As Long,

     ByVal Offset As Integer,

     ByVal Output As Long)


The offset parameter indicates the location of a parsing error. If offset >= 0, the error was detected at the specified offset in the string passed to EvalMapleStatement. If offset < 0, the error is not a parsing error; it is a computation error.


The msg parameter contains the text of the error message.


The data parameter contains the same data as passed to StartMaple in the user_data parameter.


If an errorCallBack function is not specified, error messages are sent to the textCallBack function, with the MAPLE_TEXT_ERROR tag.


Public Sub ErrorCallBack(ByVal data As Long, _

          ByVal Offset As Integer, ByVal Output As Long)

   MsgBox " at offset " + str(Offset) + " " + _

      MaplePointerToString(Output), vbInformation, ""

End Sub

' assignment to MapleCallback entry

cb.lpErrorCallBack = GetProc(AddressOf ErrorCallBack)

' test statement that will invoke the ErrorCallBack

EvalMapleStatement kv, "error(""invalid argument: %1"",x+y);"

See Also

callBackCallBack, OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples, queryInterrupt, readLineCallBack, redirectCallBack, StartMaple, statusCallBack, streamCallBack, textCallBack

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam