User`s guide
Supported Executable Types
5-21
Supported Executable Types
Wrapper functions create a link between the Compiler-generated code and a
supported executable type by providing the required interface that allows the
code to operate in the desired execution environment.
The wrapper functions differ depending on the execution environment,
whereas the C and C++ header files and code that are generated by the
Compiler are the same for MEX-functions, stand-alone applications, and
libraries.
To provide the required interface, the wrapper
• Defines persistent/global variables
• Initializes the
feval function table for run-time feval support
• Performs wrapper-specific initialization and termination
• Initializes the constant pools generated by optimization
This section discusses the various wrappers that can be generated using the
MATLAB Compiler.
Note When the Compiler generates a wrapper function, it must examine all
of the
.m files that will be included into the executable. If you do not include all
the files, the Compiler may not define all of the global variables. Optimized
code will not run at all without initialization.
Generating Files
You can use the -t option of the Compiler to generate source files in addition
to wrapper files. For example,
mcc -W main -h x.m
examines x.m and all M-files referenced by x.m, but generates only the
x_main.c wrapper file. However, including the -t option in
mcc -W main -h -t x.m
generates x_main.c, x.c, and all M-files referenced by x.m.