MATLAB: Are .mexw32 files enough to build RTW code

rtw build using s-function

We have received a plant model from a customer which has used s-function to replace some of original Simulink blocks. We can use the model for PC based simulation (with mexw32 files included). My question is if I can use the s-function to RTW build an executable code for a HIL system (such as Opal-RT or Pi Autosim). I did try it and it seems not working. I think to build an executable code for a HIL system, we may need either original Simulink model or all .c/.h files while generating the s-function. Is my understanding correct? Thanks for answer and suggestions.

Best Answer

.mex* files are files that have been compiled for use with MS Windows on x86 based processors. They are, internally, the same structure as .dll files -- i.e., only for use with Windows.
Deploying to a HIL system is very likely deploying to a system with a non-Windows OS, and probably to a system that does not use an x86 type processor.
I think you are going to need to go back to the .c/.h, and you might even need to go back to Simulink and regenerate for a different target in order to take advantage of any .tlc information that might be available for the new target.