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

14 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Kaustubha Govind
Kaustubha Govind il 16 Ago 2013
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.

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by