Code generation error with Re-usable storage class

10 ビュー (過去 30 日間)
Phani Teja
Phani Teja 2019 年 11 月 11 日
回答済み: Raag 2025 年 3 月 7 日
The struct pointer is defined in the external c code and we are trying to import and reuse the same in auto code using custom storage class Reusable
But we encountered with the following error,
Reusable CSC specification can not be honoured when function prototyping control is enabled.
Any work around to resolve this issue will be appreciated.
Thanks in advance.

回答 (1 件)

Raag
Raag 2025 年 3 月 7 日
Hello Phani,
The error you're encountering occurs because when function prototyping is enabled, MATLAB Coder expects complete function prototypes. This conflicts with the "Reusable" storage class you’re trying to use for your externally defined struct pointer. In simple terms, the code generator can’t reconcile a reusable external structure with the strict function prototypes it's set to enforce.
One straightforward workaround is to disable function prototyping in your code generation configuration.For example, if you're using MATLAB Coder, you can modify your configuration as follows:
cfg = coder.config('exe');
cfg.EnableFunctionPrototyping = false;
codegen yourFunction -config cfg
This change tells the code generator not to enforce full function prototypes, allowing your Reusable storage class to be honoured.
For a better understanding of the above solution, refer to the following MATLAB documentation:
1. Configure Code Generation and Build Settings: https://www.mathworks.com/help/coder/ug/build-setting-configuration.html

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by