User`s guide

R2007b
19-38
External Interfaces/API
Support for 64-bit mxArrays
MATLAB Version 7.5 (R2007b) supports 64-bit mxArrays. This change allows C/C++ and
Fortran files built on 64-bit platforms to handle large data arrays.
In earlier versions of MATLAB, mxArrays are limited to 2
31
-1 elements. In Version 7.5
(R2007b) your mxArray can have up to 2
48
-1 elements.
The mex command option, -largeArrayDims, uses the large-array-handling mxArray
API. Use mwSize to represents size values, such as array dimensions and number of
elements. Use mwIndex to represent index values, such as indices into arrays.
Compatibility Considerations
MEX-files that built properly in previous versions of MATLAB continue to build in
Version 7.5 (R2007b).
The default option for mex is -compatibleArrayDims. If you use this option, mex builds
the files using the 32-bit array-handling API.
To work with 64-bit mxArrays, your C, C++ and Fortran source code must comply with
the 64-bit array-handling API. To use the API to create C/C++ MEX-files, see Handling
Large mxArrays . To use the API to create Fortran MEX-files, see Handling Large
mxArrays .
Fortran MEX-Files Will Require mwSize and mwIndex
In a future version of MATLAB, the default mex command option will change to -
largeArrayDims. Fortran MEX-files will be required to use the mwSize and mwIndex
preprocessor macros
Compatibility Considerations
To make your Fortran MEX-file compatible with the -largeArrayDims option, and
to create platform-independent code, you need to include the fintrf.h header file in
your Fortran source files, and you need to name your source files with an uppercase .F
file extension. For information on creating MEX-files, see the Gateway Routine in the
Fortran MEX-Files topic.