Clear Filters
Clear Filters

Simulink Desktop Real-time in external mode with S-Function blocks generated using C++ classes and Objects

2 views (last 30 days)
Hello to every one interested in this question.
I am trying to simulate a model using the Simulink Desktop real-time in external mode, and as mentioned in the title, I have an S-Function block. The mex files that are used by the S-function block are created using C++ source.
As mentioned in the user guide all the memory allocation is done within the mdlStart method. The objects created are made persistent by using the Pwork vector as mentioned in "http://www.mathworks.com/help/simulink/sfg/making-c-objects-persistent.html".
The S-function mex files are created, and the Simulink model is compile without any errors. Now, the Simulink model also runs in the normal mode as expected. But when I tried to connect the Simulink in external mode, the following error occurs: Error loading real-time image: undefined symbol "_ZdlPv".
When I demangled the symbol, I see that this is the operator delete(void*).
(1) Does this mean that the standard library headers are not available for the real-time compiler??
What I tried to do is I have replaced the delete() operator with a custom implementation, but only to realize that the delete() operator is C++ does more than just delete the memory (it also calls the default destructor of the class).
(2) Is C++ code supported at all by the Simulink Desktop real-time?
(3) Do I really have to also code the calls to delete() operator in the mdlTerminate() method??
Thanks for your support.
Vamsi.
PS: I am using Matlab R2015a.

Answers (1)

Bing Li
Bing Li on 17 Oct 2018
hi have you solve this problem?

Community Treasure Hunt

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

Start Hunting!