MATLAB: Does the generated code from S-Function Builder contain a warning about recompiling using the 32-bit API

simulink coder

I am using S-Function Builder, and when I press the 'Build' button, the diagnostic viewer contains a warning:
"Including tmwtypes.h before simstruc.h will cause tmwtypes.h to be built
using 64-bit API. Recompiling the code to use 32-bit API. You can find more
information about this at: MEX Builds With 64-Bit API by Default"
Is this expected?

Best Answer

The warning that is being generated is thrown by the 'mex' command when it is compiling the S-Function, and is thrown whenever tmwtypes.h is included before simstruc.h. There are two different APIs, a 64-bit API and a 32-bit API, that can be used when generating MEX files (64-bit being the default). This warning is expected behavior in the case of S-Functions because they are compiled in 32-bit mode and so use the 32-bit API. Currently, 'mex' is not aware if it is compiling an S-Function specifically, so this warning is thrown whenever tmwtypes.h appears before simstruc.h in any context.
No action should be required on your end for you to keep using S-Function builder, and it will generate and compile the generated code as expected.