!$DEC cross-platform

!$DEC cross-platform

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?

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

!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:


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

Retired 12/31/2016

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.

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.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today