Main Content

Code replacement libraries

Libraries that define code optimizations for specific target environment

Model Configuration Pane: Code Generation / Interface


The Code replacement libraries parameter specifies code replacement libraries that the code generator uses when producing code for a model. A code replacement library defines code optimizations for a specific target environment.

To select a code replacement library, click the Select button and use the Select code replacement libraries-prioritized dialog box.


None | named code replacement libraries


Does not use a code replacement library.

Named code replacement libraries

Generates calls to multiple platform-specific, compiler, custom, or standard code replacement libraries. The list of named libraries depends on:

  • Installed support packages.

  • System target file, language, language standard, and device vendor configuration.

  • Whether you created and registered code replacement libraries.


  • Order the code replacement libraries based on the priority of code replacement. Libraries at the top of the list have a higher priority of replacement.

  • Specify multiple code replacement libraries enclosed by single quotes and separated by commas.

  • 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 the Shared code placement parameter to Shared location or you generate code for models in a model reference hierarchy:

    • For models that are sharing the location or are in the model hierarchy, you 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.

    • Before regenerating code, you change the code replacement library name or contents.

  • If you have the Embedded Coder® Support Package for ARM® Cortex®-A Processors, you can generate SIMD code optimized for ARM Cortex A processors by setting the code replacement libraries parameter to GCC ARM Cortex-A.

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyValid libraries
Safety precautionNo impact

Programmatic Use

Parameter: CodeReplacementLibrary
Type: character vector
Value: 'None' | 'GNU C99 extensions' | 'AUTOSAR 4.0' | 'GCC ARM Cortex-A' | 'myCustomLibrary'
Default: 'None'

Version History

Introduced in R2012a