How do I create stub functions in simulink for legacy code?

조회 수: 13 (최근 30일)
Nathan Crosty
Nathan Crosty 2013년 8월 15일
I would like to use sfunctions to create function calls to a external c functions. I don't want to build the actual legacy code when I try to build the model, but I would rather just create stub functions. What is the best way to accomplish this?
I have created stub.h./stub.c files with empty function calls (with the actual function call names), and then generated the sfunctions with the legacy code tool, but of course the autocoder includes stub.h. Rather than stub.h, I would rather include the actual .h file that is the true header file.
Thank you for and advice.

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2013년 8월 16일
I think the right way to do what you want to achieve is to create a DLL for your external C-functions and load it dynamically from the S-function. Note that the interface to the functions still needs to be fully specified in the header file and if changed needs the S-function to be re-compiled. However, using a DLL allows you to compile/maintain your external C code independently from the S-function.

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by