I am generating ERT Code with the Real-Time Workshop Embedded Coder 5.3 (R2009a). As Interface with my custom Code, I am using Bus Objects with about 100 Inputs and 50 Outputs.
After Code generation I want to test the DLL in my Simulink environment. Therefore I am using the S-Function Builder.
Unfortunately the S-Function Builder does not generate the same *_types.h file as the Embedded Coder does. Please see the following example:
A Bus Object "DLL_Output" in the MATLAB workspace is defined with the following fields in the following order:
DLL_Output+-- Time+-- Terminal_Condition+-- PositionX+-- PositionY+-- PositionZ
Then the Embedded Coder is generating the correct Header file with a struct in correct order:
typedef struct { real_T Time real_T Terminal_Condition real_T PositionX real_T PositionY real_T PositionZ} DLL_Output;
But the S-Function builder is generating an incorrect header with a struct in some other order:
typedef struct { real_T Terminal_Condition real_T PositionX real_T Time real_T PositionY real_T PositionZ} DLL_Output;
The issue is that this type definition generated by the S-Function builder cannot be used calling the interface of the DLL which was generated with the Embedded Coder.
Is there a workaround for this issue?
Best Answer