Why does my MEX file that used to work before R2017a now crash MATLAB?

1 view (last 30 days)
I wrote a MEX file a few years ago and it worked fine in MATLAB. After upgrading to MATLAB R2017a and recompiling the MEX file, however, it now crashes MATLAB on execution. What has changed that would cause this to happen?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Apr 2023
Edited: MathWorks Support Team on 13 Apr 2023
In MATLAB R2017a, the mex function uses the large-array-handling API (-largeArrayDims option) by default. If your older MEX file code was written without consideration of this change, it is possible that it will now crash MATLAB.
Best practice is to update your MEX source code to use this library and rebuild the MEX file. For instructions, see:
Run this command in MATLAB 2017a for documentation:
>> web(fullfile(docroot, 'matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html'))
Or,
for latest release documentation please refer to:
If you do not update your MEX source code, you can still build your MEX files using the -compatibleArrayDims option. For information about the consequences of using the -compatibleArrayDims option to build MEX files, see:
Run this command in MATLAB 2017a for documentation:
>> web(fullfile(docroot, 'matlab/matlab_external/what-if-i-do-not-upgrade.html'))
Or,
for latest release documentation please refer to:

More Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!