What is the meaning of "-largeArrayDims"?

8 visualizaciones (últimos 30 días)
Yi
Yi el 20 de Oct. de 2014
Respondida: SK el 20 de Oct. de 2014
When I compile mex function, What is the meaning of "-largeArrayDims"? The following is other people's code. Why is "-largeArrayDims" added on 64-bit machines?
% This make.m is used under Windows
%add -largeArrayDims on 64-bit machines
mex -O -c svm.cpp -largeArrayDims mex -O -c svm_model_matlab.c -largeArrayDims mex -O svmtrain.c svm.obj svm_model_matlab.obj -largeArrayDims mex -O svmpredict.c svm.obj svm_model_matlab.obj -largeArrayDims mex -O libsvmread.c -largeArrayDims mex -O libsvmwrite.c -largeArrayDims

Respuestas (2)

SK
SK el 20 de Oct. de 2014
Without -largeArrayDims, the index type (mwIndex) in files that you compile with the matlab libraries is typedefed as 'int' (in C) which is platform dependent (but often 32 bit). On the other hand if you compile with -largeArrayDims, it is typedefed as size_t which in C or C++ is guaranteed to be the largest integer type available for the platform.
On 64 bit platforms, you know for sure that 64 bit integer is available and that it will actually be useful. You can also add the switch on 32 bit platforms, but it is likely that you cant really create arrays of that size on 32 bit platforms so it may not be as useful or at worst pointless.

Stalin Samuel
Stalin Samuel el 20 de Oct. de 2014

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by