MEX files on 64-bits architectures
Since Matlab 7.3, the following types are defined for MEX-files:
mwSize: represents size values, such as array dimensions and number of elements
mwIndex: represents index values, such as indices into arrays
On 32-bits machines, these types are simply aliases for int.
On 64-bits machines, it depends on whether one gives the -largeArrayDims for the MEX command:
without -largeArrayDims, these types are int (and therefore 32 bits)
with -largeArrayDims, these types are size_t, which is an alias for unsigned long (and therefore 64 bits)
See Matlab 7.3 release notes for more details.
Since it is mandatory to use the -largeArrayDims when using sparse arrays on 64-bits architectures (and since this option will probably be the default in future versions of Matlab), Dynare's MEX-files are compiled with this option on 64-bits architectures.
This implies that, when coding MEX-files for Dynare, one should not expect that mwSize, mwIndex and int are synonymous.
In particular, appropriate type conversions should be made, especially when pointers are concerned. Such conversions are, for example, used in A_times_B_kronecker_C.