Code generation error with Re-usable storage class

2 Ansichten (letzte 30 Tage)
Phani Teja
Phani Teja am 11 Nov. 2019
Beantwortet: Raag am 7 Mär. 2025
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.

Antworten (1)

Raag
Raag am 7 Mär. 2025
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

Kategorien

Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by