Main Content

What If I Do Not Upgrade?

If you do not update your MEX source code, you can still build your MEX files using the -compatibleArrayDims option. Use this flag to ensure the desired behavior across versions of MATLAB®. If you build without the -compatibleArrayDims flag, then one or more of the following could occur:

  • Increased compiler warnings and/or errors from your native compiler

  • Run-time errors

  • Wrong answers

Can I Run Existing Binary MEX Files?

You can run existing binary MEX files without upgrading the files for use with the 64-bit API. However, incompatibilities might prevent execution of an existing MEX file. If your MEX file does not execute properly, search for mex in the relevant MATLAB release notes and review the Compatibility Considerations topics.

Must I Update Source MEX Files on 64-Bit Platforms?

If you build MEX files on 64-bit platforms or write platform-independent applications, you must upgrade your MEX files. To upgrade, review your source code, make appropriate changes, and rebuild using the mex command.

What action you take now depends on whether your MEX files currently use the 64-bit API. The following table helps you identify your next actions.

State of Your Source CodeNext Action

I do not plan to update my code.

You have chosen to opt out and you must build using the -compatibleArrayDims flag. However, in a future version of MATLAB, the compatibility layer, with the -compatibleArrayDims flag, might be unsupported.

I want to update my code. Where do I start?

See Upgrade MEX Files to Use 64-Bit API.

I use MEX files, but do not have access to the source code.

Ask the owner of the source code to follow the steps in Upgrade MEX Files to Use 64-Bit API.

I use third-party libraries.

Ask the vendor if the libraries support 64-bit indexing. If not, you cannot use these libraries to create 64-bit MEX files. Build your MEX file using the -compatibleArrayDims flag.

If the libraries support 64-bit indexing, review your source code, following the steps in Upgrade MEX Files to Use 64-Bit API, and then test.

I updated my code in a previous release.

No change required. However, you no longer need to use the -largeArrayDims option when building the MEX file.

My MEX file generates errors.

You must recompile the MEX file from the source code. If using the -compatibleArrayDims flag does not resolve the issue, then there might be incompatibilities in your source code. For information about incompatibilities, see Can I Run Existing Binary MEX Files?. MathWorks recommends that you update your MEX source code to use the 64-bit API.

Related Examples

More About