Main Content

ssSetSupportedForCodeReuseAcrossModels

Specify if S-function can be reused across models

Since R2021a

Syntax

void ssSetSupportedForCodeReuseAcrossModels(SimStruct *S, int_T val)

Arguments

S

SimStruct that represents an S-Function block.

val

Either an int_T (1 or 0) or boolean_T (true or false) value.

Description

Use this function in mdlInitializeSizes method to specify whether you can reuse the S-function inside a reusable library subsystem across the model reference hierarchy.

You must set the SS_OPTION_WORKS_WITH_CODE_REUSE flag to true in the ssSetOptions function.

Configure the S-function for code reuse across models only if the S-function does not access any model-specific data structures. The generated code in _sharedutils folder is compiled separately than the generated code in model_ert_rtw folder. The reusable library subsystem code generated in the _sharedutils folder does not have access to types and macros that are declared in model.h. The reusable library subsystem code must be independent.

Languages

C, C++

Examples

static void mdlInitializeSizes(SimStruct *S)
{
    ssSetOptions(S,
                 SS_OPTION_WORKS_WITH_CODE_REUSE |
                 SS_OPTION_EXCEPTION_FREE_CODE |
                 SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME);
    ssSetSupportedForCodeReuseAcrossModels(S, 1);
}

Related Topics

S-Functions for Code Reuse (Simulink Coder)

Version History

Introduced in R2021a