Clear Filters
Clear Filters

Matlab crashes while debugging mex file

4 views (last 30 days)
I am writing C code and compiling to mex files. I compile with the -g option and debug with Visual Studio (I use the Tools -> Attach to Process option in VS). However, when there is an error in the code and I stop the run (with the Stop Debugging button) Matlab crashes. This also happens if I simply run a mex file with an error and Visual Studio is not attached to Matlab.
Is there a way to debug C code without Matlab crashing?
Thanks a lot,
Michael.

Accepted Answer

Walter Roberson
Walter Roberson on 2 Jul 2012
With mex files, you are potentially corrupting the internal state of MATLAB. There is no protection layer or emulation layer: you get direct access to pointers being used by MATLAB and if (perhaps due to bugs) your code doesn't play well with MATLAB, then MATLAB will crash.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!