Main Content

Code replacement library


Specify a code replacement library that the code generator uses when producing code for a model.

Category: Code Generation > Interface


Default: None


Does not use a code replacement library.

Named code replacement libraries

Generates calls to a specific platform, compiler, or standards code replacement library. The list of named libraries depends on system target file.


  • Before setting this parameter, verify that your compiler supports the library that you want to use. If you select a parameter value that your compiler does not support, compiler errors can occur.

  • If you set parameter Shared code placement to Shared location or you generate code for models in a model reference hierarchy,

    • Models that are sharing the location or are in the model hierarchy must specify the same code replacement library (same name, tables, and table entries).

    • If you change the name or contents of the code replacement library and rebuild the model from the same folder as the previous build, the code generator reports a checksum warning (see Manage the Shared Utility Code Checksum). The warning prompts you to remove the existing folder and stop or stop code generation.

  • If both of the following conditions exist for a model that contains Stateflow® charts, the Simulink® software regenerates code for the charts and recompiles the generated code.

    • You do not set parameter Shared code placement to Shared location.

    • You change the code replacement library name or contents before regenerating code.


  • This parameter appears only for GRT-based targets. For ERT-based targets, use the parameter Code replacement libraries (Embedded Coder).

Command-Line Information

Parameter: CodeReplacementLibrary
Type: character vector
Value: 'None' | 'GNU C99 extensions'
Default: 'None'

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyValid library
Safety precautionNo impact

Related Topics