Force call tomdlTerminate
Guarantees the Simulink®engine calls the S-function'smdlTerminate
method before destroying a block that references the S-function. CallingmdlTerminate
allows your S-function to clean up after itself, for example, by freeing memory it allocated during a simulation. The engine destroys an S-function block under the following circumstances.
A simulation ends either normally or as a result of invokingssSetErrorStatus
.
A user deletes the block.
The engine eliminates the block as part of a block reduction optimization (seeBlock reduction).
If this option is not set, the engine calls your S-function'smdlTerminate
method only if themdlStart
method of at least one block in the model containing the S-function executed without error.
See the S-functionsfun_runtime3.c
for an example.