User`s guide
Code Generation Overview
5-3
b = y;
end
fun M-File
function a = fun(b)
a(1) = b(1) .* b(1);
a(2) = b(1) + b(2);
a(3) = b(2) / 4;
sample M-File
function y = sample( varargin )
varargin{:}
y = 0;
Generated Code
This chapter investigates the generated header files, interface functions, and
wrapper functions for the C MEX, stand-alone C and C++ targets, and C and
C++ libraries.
When you use the MATLAB Compiler to compile an M-file, it generates these
files:
• C or C++ code, depending on your target language (
-L) specification
• Header file
• Wrapper file, depending on the
-W option
The C or C++ code that is generated by the Compiler and the header file are
independent of the final target type and target platform. That is, the C or C++
code and header file are identical no matter what the desired final output. The
wrapper file provides the code necessary to support the output executable type.
So, the wrapper file is different for each executable type.
Table 5-1, Compiler-Generated Files, shows the names of the files generated
when you compile a generic M-file Table 5-1(
file.m) for the MEX and
stand-alone targets. The table also shows the files generated when you compile
a set of files (
filelist) for the library target and the COM target.