Simulink crashes when running MEX functions created with Visual Studio 2022 17.10.4

9 views (last 30 days)
We have been running MATLAB R2023B Update 7 with Simulink models using S-Functions built with VS 2022 17.9.0. When we updated to VS 2022 17.10.4 we starting having MATLAB crashes as soon as Simulink starts executing models with these MEX functions. Is this a known issue, and do we know if moving to Update 8 or 9 will fix it?

Accepted Answer

Benjamin Thompson
Benjamin Thompson on 13 Sep 2024
I guess I can answer my own question with some help from an older post and some great help from the MATLAB support team.
MATLAB R2023B Update 7 through 9 are delivered with a version of MSVP140 DLLs that is not compatible with a change in MSVCP runtime that happened sometime after the 17.9.0 release and the 17.10.4 release, not sure exactly when. This can be fixed after installing VS 2022 17.10.4 or later (MSVC runtime 14.40.x) if you go to the Windows\System32 folder and copy all the MSVCP140 DLLs (there are maybe 5 of them depending on the VS 2022 package options you chose) to the MATLAB bin\win64 folder.
If using the MATLAB runtime, do the same thing in the MATLAB Runtime\R2023B\...not sure...\bin\win64 folder. But don't go replacing every copy of those DLLs you can find because applications or certain parts of MATLAB may truly depend on the older runtime version.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!