Main Content

Data declaration


Specify where extern, typedef, and #define statements are to be declared.

Category: Code Generation > Code Placement


Default: Auto


Lets the code generator determine where the declarations should be located.

Data declared in source file

Places declarations in .c source files where functions are located. The data header template file is not used. The code generator places the declarations in one or more function .c files, depending on the number of function source files and the file partitioning previously selected in the Simulink® model.

Data defined in a single separate source file

Places declarations in the data header file specified in the Data declaration filename field. The code generator organizes and formats the declarations based on the data header template specified by the header file (*.h) template parameter in the data section of the Code Generation pane: Templates tab.


This parameter applies to data with storage classes except these:

  • ExportedGlobal

  • ImportedExtern

  • ImportedExternPointer

  • BitField

  • FileScope

  • Localizable

  • Struct

  • CompilerFlag


This parameter enables Data declaration filename.

Command-Line Information

Parameter: GlobalDataReference
Type: character vector
Value: 'Auto' | 'InSourceFile' | 'InSeparateHeaderFile'
Default: 'Auto'

Recommended Settings

DebuggingNo impact
TraceabilityA valid value
EfficiencyNo impact
Safety precautionNo impact

See Also

Related Topics