MATLAB: How to prevent the MATLAB Compiler-generated shared library functions from displaying printed text to the screen

boxcompilererrorhandlerlibraryMATLAB Compilermessagemsgboxoverrideprintsharedstderrstdout

I would like to obtain a string containing the text that is normally output to the screen from my MATLAB Compiler-generated shared libraries. Instead of automatically printing these messages, I would like to display them in a dialog box, or otherwise alter how my application displays the text of the message. MATLAB Compiler 3.0 (R13) provided the "mlfSetPrintHandler" function for this purpose, but this function seems to no longer exist in MATLAB Compiler 4.0 (R14).

Best Answer

To achieve the same functionality as the "mlfSetPrintHandler" function, you can create your own version of the "mclDefaultPrintHandler" function in the code that uses your library. For more information you can refer to the following location:
To use your version of the "mclDefaultPrintHandler" function, you will need to pass a pointer to the function when you initialize your library using the "[libname]InitializeWithHandlers" form of the initialization function, where <libname> is the name of your shared library. For more information, you can refer to the following location: