Main Content

C++ Code Generation and Integration in Stateflow

This example shows how custom C++ files can be used in a Stateflow® model.

C++ Code Integration

You can integrate C++ code into a model by using Stateflow. These steps illustrate the workflow:

  1. Create a C-style wrapper function or create access macros for each method called within the C chart.

  2. Open the Model Configuration Parameters dialog box. In the Simulation Target pane, add the custom header file, source files, and any include directories.

  3. In the Code Generation > Custom Code pane, enter the same information.

C++ Code Generation

Open the Model Configuration Parameters dialog box. In the Code Generation pane, change the Language setting to C++.

Related Topics