User`s guide

Writing Wrapper S-Functions
4-15
to your C algorithm (my_alg), you can elim inate bo th the SimStruct and the
extra function call, thereby improving the efficiency and reducing the size of
the generated code.
Inlining a wrapper S-function requires an
sfunction.tlc file for the
S-function; this file must contain the function call to
my_alg.Thispicture
shows the relationships between the algorithm, the wrapper S-function, and
the
sfunction.tlc file:
Figure 4-2: Inlining an Algorithm by Using a TLC File
To inline this ca ll, y o u hav e t o place your function cal l into an sfunction.tlc
file with the sam e na me as t he S-function (in this example, wrapsfcn.tlc).
This cause s the Target L ang u ag e Compiler t o override the default met hod of
my_alg.c
myalg()
{
<C code here>
}
wrapper.c
...
MdlOutputs
{
...
y = my_alg();
...
}
...
wrapsfcn.tlc
...
%<y> = my_alg(%<u>);
...
The wrapsfcn.tlc file tells the
Real-Time Workshop how to inline the
call to
my_alg using this statement: