Documentation Center    • Trial Software   • Product Updates
DWork Vector Basics  What is a DWork Vector?  DWork vectors are
blocks of memory that an S-function asks the Simulink® engine to
allocate to each instance of the S-function in a model. If
multiple instances of your S-function can occur in a model, your
S-function must use DWork vectors instead of global or static
memory to store instance-specific values of S-function
variables. Otherwise, your S-function runs the risk of one
instance overwriting data needed by another instance, causing a
simulation to fail or produce incorrect results. The ability to
keep track of multiple instances of an S-function is called
reentrancy.  You can create an S-function that is reentrant by
using DWork vectors that the engine manages for each particular
instance of the S-function.  Advantages of DWork Vectors  DWork
vectors have several advantages:    • Provide instance-specific
storage for block variables    • Support floating-point,
integer, pointer, and general da