How do I resolve a MATLAB crash when using C++ Interface library?

5 views (last 30 days)
When I call my custom C++ library using MATLAB C++ Interface, MATLAB crashes. How can resolve this issue?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 Apr 2023
Edited: MathWorks Support Team on 21 Mar 2023
A MATLAB crash while using a custom C++ library could be caused by a number of issues, including an issue with the custom library (for example, coding error) or a version conflict between the custom library, or its dependencies, and third-party C++ libraries that are shipped with MATLAB.
For both of these types of causes, it might be beneficial to use out-of-process execution mode (available in R2023a, and later releases).
If a library conflict is the cause of the crash, working in out-of-process execution mode may resolve the issue, since out-of-process execution mode has fewer dependencies on third-party libraries. Also, if the library conflict is not resolved by using out-of-process execution mode, the process will simply terminate and MATLAB will not crash.
Similarly, if the crash is due to a coding issue, then debugging and testing the code will be easier in out-of-process execution mode, since errors will simply cause the process to terminate and MATLAB will not crash. In addition, after making code changes, the library can be unloaded and reloaded without having to restart MATLAB.
 

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!

Translated by