Compile Model Reference with S-function & TLC

조회 수: 7 (최근 30일)
Thomas Satterly Satterly
Thomas Satterly Satterly 2019년 4월 24일
답변: Thomas Satterly Satterly 2019년 4월 25일
I have a working S-function that I can mex for use in normal mode and a TLC file that successfully compiles and runs in accelerator mode. However, when trying to use the S-function in an accelerated reference model or a standalone model in rapid accelerator mode, compilation fails. The errors started with redefinition errors, mainly in "matrix.h" vs. "rt_matrix". If I force the use of strictly matrix.h, the compiler seems to not know of the "bool" type in the files "slMdlrefSfcnBridge.h" and "matrix.h", as it complains about syntax errors (like "missing ')' before identifier"). Has anyone encounter these errors before, and is there a workaround?

채택된 답변

Thomas Satterly Satterly
Thomas Satterly Satterly 2019년 4월 25일
It turned out that the tool I was integrating, which was developed by someone else in Matlab and converted into C++ with the coder, included a "rtwtypes.h" file. Because the tool was developed in a newer version of Matlab (2016 vs 2013), it was the root of a lot of redefinition errors and unrecognized types. After replacing it with the 2013 version of "rtwtypes.h" and adding in defines for "TRUE" and "FALSE", everything finallaly compiled together and worked. Last problem is that the PWork vector seems to lose its functionality if external libraries are used during compilation, and stranger still, external library static variables only persist for a single major time step in Simulink, so there's no easy workarounds.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by