MATLAB COMPILER RELEASE NOTES User's Guide Page 160

  • Download
  • Add to my manuals
  • Print
  • Page
    / 264
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 159
5 Controlling Code Generation
5-44
Print Handlers
A print handler i s a routine that controls how your application displays the
output generated by calls to
mlf routines.
The system p rovides a default print handler for your application. The d efault
print handler writes output to the standard output stream. If this print
handler is suitable for your application, you do not need to write and register
another print handler.
However, you can override the default behavior by writing and registering an
alternative print handler. In fact, if you are coding a s tand-alone app lication
with a GUI, then youmustregister anotherprinthandlertodisplay application
output inside a GUI mechanism, such as a Windows message box or a Motif
Label widget.
You write an alternative print handler routine in C or C++ and register its
name at the beginning of your stand-alone application.
The way you register a print handler depends on whether or not “the
main
routine” (or first routine called) for your application is written in C or in M.
Note The print handlers and registration functions discussed in this section
are written for C applications. Although they will work in C++ applications,
we recommend that you use a C++ print handler and the C++ registration
routine
mwSetPrintHandler() for C++ applications. See the MATLAB C++
Math Library User’s Guide for details about C++ print handlers.
Main Routine Written in C
If your main routine is coded in C (as opposed to being written as an M-file),
you must:
Register a print handler in your main routine.
Write the print handler.
This section references source code from a sample stand-alone application
written for Microsoft Windows. The main routine
WinMain iswritteninC.The
source code illustrates how to register and write a print handler.
Page view 159
1 2 ... 155 156 157 158 159 160 161 162 163 164 165 ... 263 264

Comments to this Manuals

No comments