Writing S-Functions    

Basic Files Required for Implementation

This section briefly describes what files and functions you'll need to create noninlined, wrapper, and fully inlined S-functions.

For S-functions to work correctly in the Simulink environment, a certain amount of overhead code is necessary. When the Real-Time Workshop generates code from models that contain S-functions (without sfunction.tlc files), it embeds some of this overhead code in the generated C code. If you want to optimize your real-time code and eliminate some of the overhead code, you must inline (or embed) your S-functions. This involves writing a TLC (sfunction.tlc) file that directs the Real-Time Workshop to eliminate all overhead code from the generated code. The Target Language Compiler, which is part of the Real-Time Workshop, processes sfunction.tlc files to define how to inline your S-function algorithm in the generated code.


  Types of S-Functions Noninlined S-Functions