Code interface packaging
Description
Select the packaging for the generated C or C++ code interface.
Category:Code Generation > Interface
环境s
Default:不nreusable function
ifLanguage被设定为C
;C++ class
ifLanguage被设定为C++
-
C++ class
-
Generate a C++ class interface to model code. The generated interface encapsulates required model data into C++ class attributes and model entry point functions into C++ class methods.
-
不nreusable function
-
Generate nonreusable code. Model data structures are statically allocated and accessed by model entry point functions directly in the model code.
-
Reusable function
-
生成可重复使用的多功能代码,如下:
For a GRT-based model, the generated
source file contains an allocation function that dynamically allocates model data for each instance of the model. For an ERT-based model, you can use theUse dynamic memory allocation for model initializationoption to control whether an allocation function is generated.model
。CThe generated code passes the real-time model data structure in, by reference, as an argument to
和the other model entry point functions.model
_stepThe real-time model data structure is exported with the
header file.model
。H
For an ERT-based model, you can use thePass root-level I/O as参数以控制根级输入和输出参数如何传递到可重复使用的模型入口点函数。它们可以包含在传递给函数的实时模型数据结构中,作为单个参数传递,也可以作为对输入结构和输出结构的引用传递。
Tips
Entry points are exported with
。要从手写代码调用入口点函数,请添加model
。H#include model.h
代码指令。当您选择时
Reusable function
, the code generator generates a pointer to the real-time model object (
).model
_m当您选择时
Reusable function
, the code generator can generate code that compiles but is not reentrant. For example, if a signal, DWork structure, or parameter data has a storage class other than汽车
, global data structures are generated.
Dependencies
The value
C++ class
is available only if theLanguage参数设置为C++
on theCode Generationpane.Selecting
Reusable function
或者C++ class
enables多实体代码错误诊断。For an ERT target, selecting
Reusable function
enablesPass root-level I/O as和Use dynamic memory allocation for model initialization。For an ERT target, selecting
C++ class
enables the following controls for customizing the model class interface:Configure C++ Class Interfacebutton
Data Member Visibility/Access Controlsubpane
Model optionsGenerate destructor和Use dynamic memory allocation for model block instantiation
For an ERT target, you can use
Reusable function
with the staticert_main.c
module, if you do the following:Select the value
Part of model data structure
forPass root-level I/O as。Select the optionUse dynamic memory allocation for model initialization。
For an ERT target, you cannot use
Reusable function
if you are using:The
model_step
功能原型控制能力The subsystem parameter与单独数据的功能
A subsystem that
多个端口共享源代码吗
Has a port that is used by multiple instances of the subsystem and has different sample times, data types, complexity, frame status, or dimensions across the instances
输出标记为全局信号
For each instance contains identical blocks with different names or parameter settings
Using
Reusable function
不会更改为功能通行子系统生成的代码。
命令行信息
范围:CodeInterfacepackaging |
Type:character vector |
Value:'C++ class' |“不可修复的功能” |“可重复使用的功能” |
Default:“不可修复的功能” ifTargetLang 被设定为'C' ;'C++ class' ifTargetLang 被设定为'C++' |
Recommended Settings
Application | 环境 |
---|---|
Debugging | 没有影响 |
Traceability | 没有影响 |
Efficiency | Reusable function 或者C++ class |
Safety precaution | 没有影响 |
See Also
相关话题
- 模型配置参数:代码生成接口
- Entry-Point Functions and Scheduling
- 从顶级模型生成返回代码
- 组合为多个模型或模型多个实例生成的代码
- 从顶级模型生成返回代码(Embedded Coder)
- Generate C++ Class Interface to Model or Subsystem Code
- Control Generation of C++ Class Interfaces(Embedded Coder)
- 子系统代码生成
- Generate Reentrant Code from Subsystems
- Generate Reentrant Code from Subsystems
- S-Functions That Support Code Reuse
- 静态主程序模块(Embedded Coder)
- 控制功能原型(Embedded Coder)
- 生成模块化功能代码(Embedded Coder)
- Generate Component Source Code for Export to External Code Base(Embedded Coder)