- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
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?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
!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:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page