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

4 次查看(过去 30 天)
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.

回答(1 个)

Bing Li
Bing Li 2018-10-17
hi have you solve this problem?

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by