Download MATLAB Compiler
Transcript
8 Libraries through the error handler. Therefore, if you redefine either of these functions, the MCR will use your version of the function for all the output that falls into class for which it invokes that handler. The default print handler takes the following form. static int mclDefaultPrintHandler(const char *s) The implementation is straightforward; it takes a string, prints it on standard output, and returns the number of characters printed. If you override or replace this function, your version must also take a string and return the number of characters “handled.” The MCR calls the print handler when an executing MATLAB file makes a request for printed output, e.g., via the MATLAB function disp. The print handler does not terminate the output with a carriage return or line feed. The default error handler has the same form as the print handler. static int mclDefaultErrorHandler(const char *s) However, the default implementation of the print handler is slightly different. It sends the output to the standard error output stream, but if the string does not end with carriage return, the error handler adds one. If you replace the default error handler with one of your own, you should perform this check as well, or some of the error messages printed by the MCR will not be properly formatted. Caution The error handler, despite its name, does not handle the actual errors, but rather the message produced after the errors have been caught and handled inside the MCR. You cannot use this function to modify the error handling behavior of the MCR -- use the try and catch statements in your MATLAB files if you want to control how a MATLAB Compiler generated application responds to an error condition. 8-28