A code replacement library defines optimizations for generated C or C++ code from Simulink® models or MATLAB® code for specific targets. You can configure the code generator to use your code replacement library to replace specified functions in your model or MATLAB code with optimized implementations.
You can use a code replacement library to optimize the performance of functions defined either by Simulink models or MATLAB code. To look up functions that are available to optimize, see Code You Can Replace From Simulink Models and Code You Can Replace from MATLAB Code.
You can develop a code replacement library either interactively, using the Code Replacement Tool (crtool), or programmatically, using the MATLAB programming interface. The Code Replacement Tool is quick, easy, and ideal for first time library development, while the MATLAB Programming interface provides more customization and control options. To determine which approach to use, identify your use case below:
Developing a code replacement library for the first time
Specifying code replacement attributes not available with the Code Replacement Tool
Creating or modifying code replacement library entries by copying, pasting, and editing
Modifying a registration file by copying and pasting content
What model or MATLAB code do you want to optimize by using a code replacement library?
What functions and operations within your model or MATLAB code do you want to replace? What is the signature for each function or operation that you want to replace?
What build files (source, header, object) do you need to provide to the code generator?