Intel Fortran with MATLAB

March 08, 2013 at 12:45 PM | categories: Fortran, Code, Matlab | View Comments

It seems that in recent versions of Matlab (from at least R2012a), some cleanup was performed on the fintrf.h header file for the Fortran interface.

Where the check for 64 bit platforms is performed, what used to be (R2011a)

#if defined(__x86_64__) || defined(_M_AMD64) || defined(__amd64) || \
    defined(__sparcv9)  || defined(__ppc64__)
# define mwpointer integer*8
# define mwPointer integer*8
# define MWPOINTER INTEGER*8
#else
# define mwpointer integer*4
# define mwPointer integer*4
# define MWPOINTER INTEGER*4
#endif

has been changed to

#if defined(__LP64__) || defined(_M_AMD64) || defined(__amd64)

Unfortunately, Intel Fortran (v12 at least) doesn't seem to define the __LP64__ macro, so to get it to work I had to put the __x86_64__ test back:

#if defined(__x86_64__) || defined(__LP64__) || defined(_M_AMD64) || \ 
    defined(__amd64) 

This was on a Mac, but I think it would be the same on Linux.

blog comments powered by Disqus