Technical data
Writing a Block Target File
3-15
Writing a Block Target File
To write a block target file, use these polymorphic block functions combined 
with the Target Language Compiler library functions declared in 
funclib.tlc. 
For a complete list of the Target Language Compiler library functions, see 
Chapter 4, “Target Language Compiler Function Library Reference.”
A brief description of the necessary block and library functions follow.
TLC Block Setup Functions
BlockInstanceSetup(block, system)
The BlockInstanceSetup function executes for all the blocks that have this 
function defined in their target files in a model. For example, if there are 10 
From Workspace blocks in a model, then the 
BlockInstanceSetup function in 
fromwks.tlc executes 10 times, once for each From Workspace block instance. 
Use 
BlockInstanceSetup to generate code for each instance of a given block 
type.
See the “Target Language Compiler Function Library Reference” for a list of 
relevant functions to call from inside this block function. See 
fromwks.tlc for 
an example of the 
BlockInstanceSetup function.
Syntax:
BlockInstanceSetup(block, system) void
block
= Reference to a Simulink block
system = Reference to a nonvirtual Simulink subsystem
As an example, given S-function 
foo with a scalar parameter representing a 
gain and one RWork representing previous inputs, you could define the 
following function.










