Main Content

ssSetSupportedForCodeReuseAcrossModels

Specify if S-function can be reused across models

Syntax

void ssSetSupportedForCodeReuseAcrossModels(SimStruct *S, int_T val)

Arguments

S

SimStruct representing an S-Function block.

val

Either anint_T (1 or 0)orboolean_T (true or false)value.

Description

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

You must set theSS_OPTION_WORKS_WITH_CODE_REUSEflag totruein thessSetOptionsfunction.

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比生成的文件夹分别编译code inmodel_ert_rtwfolder. The reusable library subsystem code generated in the_sharedutilsfolder does not have access to types and macros that are declared inmodel.h. The reusable library subsystem code must be independent.

Languages

C, C++

Example

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