The Reusable function setting of the model configuration parameter Code interface packaging allows generated code to receive model data by function arguments. The generated code is reentrant. By default, Reusable function is not selected. Global data structures communicate model data to the generated code and access data with direct memory access. The generated code is not reentrant.
With Embedded Coder®, you determine whether the generated code passes root-level input and output as individual arguments, as structure references, or as part of the real-time model data structure. You can control whether the generated code allocates memory for model data statically or dynamically (using
To select the Reusable function from the Code interface packaging options:
From the Simulink Editor, select Simulation > Model Configuration Parameters
Select the Code Generation > Interface pane.
Select the Reusable function from the Code interface packaging options.
Configure the Multi-instance code error diagnostic option.
Configure the Pass root-level I/O as option (Embedded Coder only).
On the All Parameters tab, select Use dynamic memory allocation for model initialization.