Validate is there is an s-function in the Simulink model with embedded coder
Show older comments
We have 2 simulink models that we convert to C++. In one simulink model we have a non-inlineable S-function. The S-function in C++ performs dynamic allocation therefore we need to check whether or not the dynamic allocation at startup has been succesful. We do something like this
for (int i = 0; i < rtM->Sizes.numSFcns; i++) {
SimStruct* rts = rtM->childSfunctions[i];
if (ssGetErrorStatus(rts) != (NULL)) {
error = true;
//TODO : Implement strncpy_s
strncpy(infoMsg, ssGetErrorStatus(rts), 100);
}
}
However, in the 2nd model, we don't have an S-function and the above code fails. Is there a way to check whether or not there's an S-function in the Simulink model either using TLC or other options in embedded coder?
we cannot use the regular initialize C++ function as the function has no return arguments and we cannot know whether or not it has failed.
Accepted Answer
More Answers (0)
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!