Main Content

Preserve static keyword in function declarations

Description

Specify whether to include the static keyword in function declarations in the generated code.

Category: Code Generation > Code Style

Settings

Default: on

On

Include the static keyword in function declarations in the generated code. You can link different executables generated from different models that refer to locally scoped subsystem and utility functions with the same name. This parameter also impacts these functions:

  • Stateflow® graphical function

  • Variant subsystem

  • MATLAB® subfunction

  • Privately scoped Simulink® function

When you select this parameter, the generated code is compliant with MISRA C:2012 Rule 8.10.

Off

Remove the static keyword in function declarations in the generated code.

Dependency

  • This parameter requires Embedded Coder® license when you generate code.

  • This parameter appears only for ERT-based targets.

  • This parameter is enabled when you select Compact/Compact(with separate data file) file packaging.

Command-Line Information

Parameter: PreserveStaticInFcnDecls
Type: character vector
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn (execution, ROM)
Safety precautionNo impact

Related Topics