Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

preprocessor directives for gfortran and Intel

$
0
0

I help to develop a Fortran/C/C++ open-source project (open-fvs) that builds on Unix, MinGW and VisualStudio/Intel Fortran tool chains, based on cmake tools. I've been stumped by a recent Fortran preprocessor issue that seems like it should be simple. Equivalent issues in C work across the 3 tool chains. In the Visual Studio-Intel Fortran 12 environment  I need to call getpid(), which requires using "USE IFPORT". I would like the same code to be able to work across all environments, and preprocessors would seem to be the way to go. Assuming __GFORTRAN__ is defined in the gfortran situation and not in VS/Intel, something like this klunky example is what I have in mind:

!DEC$ IF DEFINED (__GFORTRAN__)
!DEC$ ELSE      
      use ifport
!DEC$ ENDIF

The !DEC$ lines are ignored by gfortran, but USE IFPORT obviously isn't. I'd appreciate advice on how to create preprocessor directives that will work across the tool chains.


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>