Main Content

model_terminate

Generated C/C++ entry-point function that contains termination code for a Simulink model

Description

void model_terminate(void) is a generated C or C++ entry-point function called one time to execute termination code for a Simulink® model.

The generated calling interface of the termination entry-point function for a model differs depending on the Language and Code interface packaging parameters. For more information, see Code interface packaging. With Embedded Coder®, you can choose whether to generate a termination function for a model by using the Terminate function required parameter. If your application runs indefinitely, clear this parameter. For more information, see Terminate function required (Embedded Coder).

To preview and customize the name of a generated C terminate entry-point function an Embedded Coder license is required. To preview the terminate entry-point function, open the Code Mappings editor and click the Functions tab. To customize the function name, in the Function Name column click and edit the spreadsheet directly. To customize the function using a template, in the Function Customization Template column select a template to apply to the function. For more information, see Configure Names for Individual C Entry-Point Functions (Embedded Coder), and Configure Default Code Generation for Functions (Embedded Coder).

To view the generated terminate entry-point function, open the Code view or Code Generation Report and examine the source code for your model. For more information see, Analyze Generated Data Code Interface Report (Embedded Coder).

example

Examples

collapse all

This example shows the basic workflow for how to configure, customize, generate, and examine the terminate entry-point function.

  1. Open a model.

  2. Select a coder. In the Apps gallery, click Simulink Coder or Embedded Coder.

  3. Set model configuration parameters Language and Code interface packaging.

  4. (Embedded Coder only) Customize the function. Using Embedded Coder, you can customize the name of the terminate entry-point function.

    • Open the Code Mappings editor.

    • Click the Functions tab.

    • In the Function Name column, enter a name for the function.

  5. Generate code.

  6. Examine the generated code. In the Code view, verify that the generated terminate function appears with the expected name and parameters.

Input Arguments

collapse all

The terminate entry-point C or C++ function provides an interface to terminate application code. By default, the generated function provides a void-void interface that does not have arguments.

Example: void

Output Arguments

collapse all

The terminate entry-point C or C++ function provides an interface to terminate application code. By default, the generated function provides a void-void interface that does not have a return value.

Example: void

Version History

Introduced before R2006a