User`s guide
5 Controlling Code Generation
5-24
Simulink S-Functions
The -W simulink -L C options produce a Simulink S-function wrapper.
Simulink S-function wrappers conform to the Simulink C S-function
conventions. The wrappers initialize
• The
sizes structure
• The S-function’s sample times array
• The S-function’s states and work vectors
• The global variables and constant pool
For more information about Simulink S-function requirements, see “Writing
S-Functions” in the Simulink documentation.
Note By default, the -S command does not include any functions that do not
appear on the command line. Functions that do not appear on the command
line would generate a callback to MATLAB. Specify
-h if you want all
functions called to be compiled into your MEX-file.
C Libraries
The intent of the C library wrapper files is to allow the inclusion of an arbitrary
set of M-files into a static library or shared library. The header file contains all
of the entry points for all of the compiled M functions. The export list contains
the set of symbols that are exported from a C shared library.
Another benefit of creating a library is that you can compile a common set of
functions once. You can then compile other M-functions that depend on them
without recompiling the original functions. You can accomplish this using
mlib
files, which are automatically generated when you generate the library. For
more information about
mlib files, see “mlib Files” on page 5-26.
Note Even if you are not producing a shared library, you must generate a
library wrapper file when including any Compiler-generated code into a larger
application.