Clear Filters
Clear Filters

Building non-inlined S-function with .c file present alongside the .cpp is causing Simulink (with Matlab R2015a) to use the .c file in the build process for the model even though the actual .mexw64 file was generated for C++.

1 view (last 30 days)
I had built a .cpp S-function with mex. After generating the code for the model, the built .exe kept crashing. So after some digging, I went into the debugger and noticed it is calling a non-existent mdlStart() in the .exe. There was a mdlStart() in my .cpp file, but the dummy .c file which was also present didn't have it and it was the .c file for some reason that was compiled during the build process, even though the .mexw64 file I had generated was for the .cpp file. Is this a bug?
  1 Comment
Jordan Ross
Jordan Ross on 23 Sep 2016
Hi Raghu,
In your model configuration parameters, do you have the code generation language selected to be C or C++?
Since your S-function is compiled in C++, I would try setting the code generation language to C++ in the model configuration parameters.

Sign in to comment.

Answers (0)

Categories

Find more on Block and Blockset Authoring in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!