I've got a large Fortran codebase that originally targeted Intel's compiler. I'm now gearing up to compile with gfortran. Unfortunately, the code is littered with Intel-style pre-processing directives like:
!DEC$ IF DEFINED (MYDIRECTIVE)
REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var
!DEC$ ENDIF
From what I can tell via googling and the gfortran docs, there is no internal gfortran support for anything besides C-style pre-processing, like:
#if defined MYDIRECTIVE
REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var
#endif
Has anyone else encountered this problem and come up with an elegant solution? Obviously, I could write a shell script which calls an external pre-processor before passing code to gfortran for compile, but this just doesn't seem like a terrific solution to me.
Any thoughts? Thanks SO gurus!
Intel ifort understands the C-style preprocessor directives, so it might be easiest to convert your files to that style. Then you would have a single code base that would work with both compilers. There would be some work regression testing the converted code with ifort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With