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

using the preprocessor to generate DLLEXPORT of procedures

Zapp_O_
Beginner
590 Views

Hi all, I develop a library coded in Fortran, which should also be compiled as a dll. For this I'm using Intel(R) Visual Fortran Composer XE 2011 Update 6 Integration for Microsoft Visual Studio* 2010, 12.1.3514.2010 I'm still new to Fortran but according to my strong C/C++ insticts I want to, as usual in C, generate the DLLEXPORT magic lines by the preprocessor. So intuitively I tried the following: #define dll_export( procId ) !DEC$ ATTRIBUTES DLLEXPORT, DECORATE, ALIAS : #procId :: procId #define dll_procArgs !DEC$ ATTRIBUTES REFERENCE ... subroutine myFunc( a ) dll_export( myFunc ) dll_procArgs :: a ... end subroutine However, for compiling this I get funny error messages, like ... error #5082: Syntax error, found '::' when expecting one of: ; BLOCK BLOCKDATA PROGRAM MODULE TYPE BYTE CHARACTER ... ... which is pointing to the line dll_procArgs :: a After some testing I suspect it's the ! generated by the macros that cause the problems. So, how can I avoid the ! character by escape sequence or trigraph - and get the DLLEXPORT magic right? Thanks!

0 Kudos
2 Replies
Steven_L_Intel1
Employee
590 Views

Try this.  If you're using a project, turn off the "Use preprocessor" property. Then on the Command Line page, add this under Additional Options:

/fpp:"-f_com=no"

This prevents the ! from being treated as a Fortran comment in the preprocessor line.

0 Kudos
Zapp_O_
Beginner
590 Views
Hi Steve, thanks a lot - it just works as expected! This saved my day :-) Zapp
0 Kudos
Reply