How to use generated types in included header file with embedded coder.

I have a Simulink model which I am generating code for. One of the output buses is required to include a union. I have set in the bus code generation settings that the data scope is imported and the name of the file defining the type. The issue is that this header file needs to use types which have been generated by embedded coder, however the generated types file includes my header file before defining its own types. Is there any way to change this behaviour? I would rather not have to modify the generated file every time.

답변 (1개)

Matthew
Matthew 2025년 3월 26일

0 개 추천

I have created a workaround for this.
  • Create another header file named "shared.h" and set that as the header file used by the Simulink buses.
  • This file should include the generated types header first and then the custom type header.
  • Enclose the whole imported type header file in an ifdef guard that checks whether the types required from the generated file exist.

카테고리

도움말 센터File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품

릴리스

R2023a

질문:

2025년 3월 26일

답변:

2025년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by