Generation of a unique library code declaration using Embedded coder

5 ビュー (過去 30 日間)
Shalaka
Shalaka 2025 年 1 月 14 日
コメント済み: Shalaka 2025 年 1 月 17 日
Hello team,
I have a library that is used inside multiple models. I am using Embedded coder to generate the code for these models.                                                                                                                                                                                                                                           
Presently, the code generation for each of these models creates a separate instance of the library and its inside functions. However, to compile the complete software package, the library and its functions should have only one instance. We want only one definition/declaration for the library and its functions without using any additional prefix/suffix.
To avoid multiple function definition/declaration errors and achieve successful compilation, would you please provide a solution to generate a unique library code?

採用された回答

Githin George
Githin George 2025 年 1 月 16 日
Hey Shalaka,
I can think of few workarounds that you may want to try:
  1. If the functionality is unique across the models, try using a “Model Reference” block and include that across all your models. This will ensure that only one instance of the code is generated and that too inside the referenced model.
  2. Use compiler directives like “#ifndef” and “#define” in your code to ensure that redeclaration doesn’t happen.
Before exploring additional options, I would like to know more about how you are integrating your complete software package. Do you have individual models for which you are generating code and are you integrating them manually?
Also, You can try using model referencing and other techniques within Simulink to streamline your approach to modeling and code generation as explained here:
  1 件のコメント
Shalaka
Shalaka 2025 年 1 月 17 日
Hello Githin,
Thank you for the answer. I will check on the suggested approaches.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by