Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Preprocessor directives !DEC$ for modules

Johannes_Rieke
New Contributor III
1,442 Views

Hi all,

the program I'm developing have to run on windows and linux and therefore I like to add preprocessor directive for system specific data/modules. What works on both platforms (ifort 12.1.6.369 on windows, gcc 4.6.3 on linux) is:

[fortran]

!dec$ if defined(_WIN32) || defined(_WIN64)
seperator = '\'
!dec$ else defined(__linux__)
seperator = '/'
!dec$ endif

[/fortran]

So far, so good. But I also want to use the directives for modules and there it seems not to work. First I tested it under windows in princible not for cross compiling but different compilers:

[fortran]

!dec$ if defined(_WIN32) || defined(_WIN64)
  use ifport
!dec$ else defined(_VF_VER=1110)
 use dfport
!dec$ end if

[/fortran]

Here I got the following error:

"error #5082: Syntax error, found 'USE' when expecting one of: FIXEDFORMLINESIZE FREEFORM NOFREEFORM STRICT NOSTRICT PACK ATTRIBUTES OBJCOMMENT ...   "

Is it forbidden for modules or made I something wrong? In this thread http://software.intel.com/en-us/forums/topic/270845 someone used preprcessor directives for modules but with another syntax ($if instead of !def$)? This is not working in ifort 12.1.6.369 also?

Any help is welcome,

Johannes

ps: ifort flags in windows: /nologo /O3 /Qparallel /heap-arrays500 /Qopt-matmul /I"D:\Arbeitsverzeichnis_Jo\Fortran\PRoSiT\PRoSiT_aux_lib\x64\Release" /I"D:\Arbeitsverzeichnis_Jo\Fortran\PRoSiT\PRoSiT_geo_lib\x64\Release" /arch:SSE3 /Qvec-report1 /real_size:64 /Qzero /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc100.pdb" /libs:static /threads /c


0 Kudos
3 Replies
Johannes_Rieke
New Contributor III
1,442 Views
UPDATE: I tested the c-style preprocessor directives with the /fpp flag and the following sytax: [fortran] #if defined(_WIN32) || defined(_WIN64) use ifport #else defined(_VF_VER=1110) use dfport #endif [/fortran] Now it seems to work in princible (although my example makes no sense anyway). Is it correct, that I can't use the fortran style preprocessor directives for modules? Kind regards, Johannes ps: Linux with gcc 4.6.3 and -cpp flag eats the same commands.
0 Kudos
Steven_L_Intel1
Employee
1,442 Views
What you tried should work. It isn't a modules issue but perhaps a parsing problem regarding USE. We'll look into it.
0 Kudos
Johannes_Rieke
New Contributor III
1,442 Views
Hi Steve, thanks for the info. I will stay tuned on this but meanwhile I can live with the c-style. offtopic: Does anybody know why __linux__ is not known by gcc 4.6.3 in scientific linux 6.3 in virtual box until I compile with -D__linux__ ? (variations __gnu_linux__, linux, __linux does not work also) Johannes
0 Kudos
Reply