Validate is there is an s-function in the Simulink model with embedded coder
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Simulink Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!