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++.

3 visualizaciones (últimos 30 días)
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 comentario
Jordan Ross
Jordan Ross el 23 de Sept. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by