MATLAB: Does Matlab crashes between mex calls

crashdllmex

Hi,
I have mex files around 15 which are linked to same dll. When I run a script using those mex functions, matlab is getting crashed inconsistently with "Access violation". I think the context between the mex calls is not maintaining properly. What to do in order to avoid that.
Thanks.

Best Answer

The asnwer is easy: One or more of the called Mex functions copntains a bug. This happens frequently, because C-code is very susceptible, e.g. if it was written and tested under a 32 bit version of the compliler and runs with 64 bit addressing now. Note that an access violation can happens directly inside the code, or even later, if the C code has created invalid Matlab variables.
You have to find out, which C function causes the crashes. Then post the code such that the readers can suggest an improvement.