User`s guide
5 Controlling Code Generation
5-42
mxDestroyArray(ans);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
mclMlineExitFunction();
}
No Annotation
To include no source from the initial M-file in the generated output, use
mcc -A annotation:none
This code snippet shows the generated code without comments and source code:
static void Mhello(void) {
mclMlineEnterFunction("D:\\work\\hello.m", "hello")
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_hello);
mxArray * ans = NULL;
mclMline(3);
mclAssignAns(
&ans,
mlfNFprintf(0, mlfScalar(1), mxCreateString("Hello, World\\n"), NULL));
mxDestroyArray(ans);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
mclMlineExitFunction();
}
Controlling #line Directives in Output Code
#line preprocessing directives inform a C/C++ compiler that the C/C++ code
was generated by another tool (MATLAB Compiler) and they identify the
correspondence between the generated code and the original source code
(M-file). You can use the
#line directives to help debug your M-file(s). Most C
language debuggers can display your M-file source code. These debuggers allow
you to set breakpoints, single step, and so on at the M-file code level when you
use the
#line directives.
Use the
line:setting option to include #line preprocessor directives in your
generated C or C++ output. The possible values for
setting are
•
on
• off
Not specifying any line setting uses the default of off, which does not include
any
#line preprocessor directives in the generated C/C++ source.