Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

!$DEC cross-platform

jd_weeks
Beginner
634 Views
In order to build a DLL on Windows, I added !$DEC ATTRIBUTES DLLEXPORT directives to some code. This code needs to build under Intel Fortran Compiler for Mac OS X as well as Windows, but this attribute causes a compiler error on Macintosh.

I would have thought that the ! at the beginning was to hide this from compilers that don't support these statements (but I am pretty close to the start of the learning curve on modern Fortran), so that you can include directives for one platform and have them not bother you on another.

Of course, I'm using the Intel compiler on both platforms...

How can I write one source that compiles on both Windows and Mac OS X, where on Windows I'm creating a DLL and on OS X a static library?
0 Kudos
3 Replies
Steven_L_Intel1
Employee
634 Views
!DEC$ is recognized as a directive introducer by Intel Fortran, so it is effectively a statement.

The way one normally does this is with conditional directives, for example:


!DEC$ IF DEFINED (_WIN32)
!DEC$ ATTRIBUTES DLLEXPORT :: MYSUB
!DEC$ ENDIF

Message Edited by Steve_Lionel on 06-09-2006 02:08 PM

0 Kudos
jd_weeks
Beginner
634 Views
Thanks, Steve. I really did look in the language documentation, but I missed the !DEC$ IF directive. Shows that I'm new to using Fortran.
0 Kudos
Steven_L_Intel1
Employee
634 Views
Well, that is not a standard Fortran feature - it's our extension. Many compilers have similar extnsions, but they're all a bit different in spelling.
0 Kudos
Reply