Troubleshoot S-Function Build Upgrade for R2020b
A pre-R2020b model uses S-Functions. When migrating this model to the current release, this S-Function related message appears in the build log:
undefined reference to 'C function in S-Function'
What This Issue Means
In R2020b, the compiler for model builds changed from a Windows® compatible C compiler to the QNX® Neutrino® C++ compiler. To accommodate this change, update S-Function code for C++ compatibility.
Tip
Fortran S-Functions are not supported in R2020b and later releases of Simulink® Real-Time™.
Try This Workaround
To update S-Function code for C++ compatibility, modify the declaration of the S-Function in the header file.
For example, update this C S-Function declaration:
void getAllDataMyFunction(short); void myfunction_initialize(short, unsigned char*, short*); void myfunction_terminate(short, int);
Updated the code to this C++ S-Function declaration:
#ifdef __cplusplus extern "C" { #endif void getAllDataMyFunction(short); void myfunction_initialize(short, unsigned char*, short*); void myfunction_terminate(short, int); #ifdef __cplusplus } #endif
Before building the updated code, remember to remove all artifacts from previous model builds.