| Target Language Compiler | ![]() |
How TLC Determines S-Function Inlining Status
Whenever the Target Language Compiler encounters an entry for an S-function block in the model.rtw file, it has to decide either to generate a call to the S-function or inline it.
Ada, Fortran, and M-file S-functions must be inlined. This inlining can either be in the form of a full block target file or a "one-liner" block target file that references a "substitute" C MEX S-function source file.
A C MEX S-function will be selected for inlining by the Target Language Compiler if there is an explicit mdlRTW() function in the S-function code or if there is a target file for the current target language for the current block in the TLC file search path. If a C MEX S-function has an explicit mdlRTW() function, there must be a corresponding target file or an error condition will result.
The target file for an S-function must have the same root name as the S-function and must have the extension .tlc. For example, the example C MEX S-function source file sfun_bitop.c has its compiled form in toolbox/simulink/blocks/sfun_bitop.dll (.mex* for UNIX) and its C target file is located in toolbox/simulink/blocks/tlc_c/sfun_bitop.tlc. This example S-function also has an Ada target file, which is located in toolbox/simulink/blocks/tlc_ada/sfun_bitop.tlc, if you have the Real-Time Workshop Ada Coder.
| Code Generation Process | A Look at Inlined and Noninlined S-Function Code | ![]() |