Matlab crashes while debugging mex file

2 visualizaciones (últimos 30 días)
Michael
Michael el 2 de Jul. de 2012
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 2 de Jul. de 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.

Más respuestas (0)

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by