Technical Solutions
Why does my class destructor not execute after an error occurs in a C++ MEX-file in MATLAB?
Date Last Modified: Friday, June 26, 2009
| Solution ID: | 1-4OKNSV | |
| Product: | MATLAB | |
| Reported in Release: | No Release | |
| Platform: | All Platforms | |
| Operating System: | All OS |
Subject:
Why does my class destructor not execute after an error occurs in a C++ MEX-file in MATLAB?
Problem Description:
I have created a C++ MEX-function. In the MEX-function, I create instances of a class. This class has a destructor which performs some cleanup. I expect the destructor to be called whenever the class instance goes out of scope. However, when an error occurs in the MEX-function, the destructor does not seem to be called.
Solution:This is a limitation of several C++ compilers which are supported for creating MEX-functions in MATLAB. The following compilers are known to have this limitation: |
|
|
Store

