MATLAB COMPILER RELEASE NOTES User's Guide Page 164

  • Download
  • Add to my manuals
  • Print
  • Page
    / 264
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 163
5 Controlling Code Generation
5-48
Main Routine Written in M-Code
If your main routine is an M-file, you must:
Write a print handler in C.
Register the print handler in y our main M-file.
Registering the print handler requires several steps, some performed in C and
some in M -code. To regist er a print handler from your main M-file, you call a
dummy print handler initialization function written in M-code. The MATLAB
Compiler translates that call into a call to the actual print handler
initialization function written in C or C++.
To set up for this translation, you must write two print handler initialization
functions:
A print handler initializa tion function in C or C++ t hat registers the print
handler
A dummy print handler ini tial ization routine in M-code that does nothing
(the body of the function is empty) except enable the MATLAB Compiler to
make the proper translation
You call the dummy print handler initialization function from your main
M-file. The MATLAB Compiler translates that call into a call to your print
handler initialization function written in C or C++.
Example Files
In this example, two M-files and one C file are built into a stand-alone
application. The main routine is
mr.m.
mr.m contains t he m ain M routine.
function mr(m)
initprnt
m=str2num(m);
r=mrank(m);
r
function initprnt
%#external
Page view 163
1 2 ... 159 160 161 162 163 164 165 166 167 168 169 ... 263 264

Comments to this Manuals

No comments