I'm trying to generate code for a simulink mode which contains:
1- a C s-function
2- a C++ s-function
The generated code is expected to run on Linux and supports the External mode simulation
I kind of reached a dead-end and I want to make sure that what I did is correct:
1- a target preferences block is added to specify Linux OS and real-time scheduling properties. This will force an ide_link_ert target using C language
2- when I build the model, embedded coder skip all C++ source code files and hence my C++ s-functions causes an undefined reference error at the link stage.
3- compiling the whole project as C++ would solve it, but ide_link_ert doesn't support C++.
4- if I ignore the target preference block and set ert target with C++ language (just to see if it works) the build comes with lots of error messages complaining about type redefinition mismatch very similar to that the guy has got here (<http://www.mathworks.com/matlabcentral/newsreader/view_thread/247302>)
5- Thought about using referenced model for the C++ s-function so that the coder will generate a library file and link it with the rest of the generated C code. The problem with this approach is (<http://www.mathworks.co.uk/help/toolbox/ecoder/ug/bq44n8v-mu.html#bq9240b-83mn>)
a. Coder with referenced models doesn't support non-inlined s-functions (my C++ s-function is not inlined)
b. Coder with referenced model doesn't support the external mode, which I need
I appreciate if someone can point out if there is anything wrong with what is mentioned above or provide any inputs of how to solve this issue.