Disable automatic termination of mex functions
Show older comments
There are a bunch of mx and mex functions that will halt execution of a mex file if something goes wrong (I assume by using longjmp under the hood).
For the function I'm writing, if the mex function terminates without giving me a chance to clean up, it would be Bad. Therefore, I have to avoid calling functions that can terminate unless I clean up first. This is simple enough for functions like mexErrMsgIdAndTxt, but there are a whole bunch of functions like mxCreateString that can terminate as well. If I'm building a complicated return value, having to release and reacquire my library state every time I make a potentially terminating call is not fun, not to mention slow.
Is there a way to disable automatic termination (so that functions will just return an error code, like they would in a standalone exe), or at least a way to be notified if the mex function terminates?
Accepted Answer
More Answers (0)
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) 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!