Main Content

SS_OPTION_CALL_TERMINATE_ON_EXIT

Force call tomdlTerminate

Description

Guarantees the Simulink®engine calls the S-function'smdlTerminatemethod before destroying a block that references the S-function. CallingmdlTerminateallows 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.

  1. A simulation ends either normally or as a result of invokingssSetErrorStatus.

  2. A user deletes the block.

  3. 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'smdlTerminatemethod only if themdlStartmethod of at least one block in the model containing the S-function executed without error.

Example

See the S-functionsfun_runtime3.cfor an example.

See Also

mdlTerminate

Introduced in R2007b