Technical data

Inlining an S-Function
3-39
Note 2 The input to foo is rtGROUND (an RTW global equal to 0.0) since foo is
the only block in the model, and its input is unconnected. Had it been
connected to block
sinewave, the generated line would have been
rtB.foo = rtB.sinewave * rtP.foo.gain;
Note 3
Including a TLC file for foogain eliminated the need for an S-function
registration segment for
foogain. This significantly reduces code size.
Note 4 The TLC code will inline the gain parameter when RTW is configured
to inline parameter values. For example, if the S-function parameter is
specified as 2.5 in the S-function dialog box, the TLC
Outputs function
generates
rtB.foo = input * 2.5;
Note 5
Use the %generatefile directive if your operating system has filename
size restriction and the name of the S-function is
foosfunction (which
exceeds the limit). In this case, you would include the following
statement in the system target file (anywhere prior to a reference to
this S-function’s block target file):
%generatefile foosfunction "foosfunc.tlc"
This statement tells the Target Language Compiler to open foosfunc.tlc
instead of
foosfunction.tlc.