ert static function declaration when using newer versions of matlab
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I am using a custom tlc file that was based off of ert.tlc from an older version matlab. The custom code had worked fine through multiple matlab versions and I can confirm it was ok up through version 2018b but is now failing when I attempt to use it with 2022b (sorry, I have no info with respect to versions in between). The code itself gets linked into a larger project but now errors out during the link due to the static declaration. I was able maunally fix the code as shown below but really need a better solution.
Code produced by RTW
/* Real-time model */
static RT_MODEL_tx2_T tx2_M_;
RT_MODEL_tx2_T *const tx2_M = &tx2_M_;
Hand modified after error
/* Real-time model */
RT_MODEL_tx2_T tx2_M_;
RT_MODEL_tx2_T *const tx2_M = &tx2_M_;
Link is now successful
Seems simple but the hand mod is not practical to do regularly for this apllication. Are there any settings or tlc files I should be looking at to eliminate the static declaration?
Thank you
Respuestas (1)
Ayush
el 1 de Sept. de 2024
Hi Martin,
It seems that the issue you're facing is related to the static declaration in your custom TLC file. Starting from MATLAB R2019a, the code generation process has been updated, which might be causing the error you're experiencing. To eliminate the static declaration, you can try modifying the TLC file by removing the "static" keyword from the declaration of tx2_M_. Here's an example of how the modified code should look:
/* Real-time model */
RT_MODEL_tx2_T tx2_M_;
RT_MODEL_tx2_T *const tx2_M = &tx2_M_;
By removing the "static" keyword, you should be able to successfully link your code without any errors.
If modifying the TLC file doesn't solve the issue, you can also check if there are any specific code generation settings that might affect the static declaration. You can review the code generation options in the Configuration Parameters dialog in MATLAB.
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!