Using the C++ Math Library    

Replacing the Default Library Error Handler

The default error handling behavior of the MATLAB C++ Math Library routines is implemented by the default library error handler routine. You can customize error handling by replacing the default library error handler routine with one of your own design.

To replace the default error handler you must:

Writing an Error Handler

When you write an error handler, you must conform to the library prototype for error handling routines:

In this prototype, note the following:

Registering Your Error Handler

After writing an error handler, you must register it with the MATLAB C Math Library so that the library routines can call it when they encounter an error condition at runtime. You register an error handler using the mwSetErrorMsgHandler() routine.


 Example Program: Handling Exceptions (ex5.cpp) Exception Handling in the MATLAB C++ Math Library