Preprocessor directives !DEC$ for modules

Preprocessor directives !DEC$ for modules

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:

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

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:

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

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

4 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

UPDATE:
I tested the c-style preprocessor directives with the /fpp flag and the following sytax:


#if defined(_WIN32) || defined(_WIN64)

    use ifport

#else defined(_VF_VER=1110)

    use dfport

#endif

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.

Ritratto di Steve Lionel (Intel)

What you tried should work. It isn't a modules issue but perhaps a parsing problem regarding USE. We'll look into it.

Steve

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

Accedere per lasciare un commento.