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

Problem when compiling !DEC$ Attributes in XE2011 and Xe2012

Christer
Beginner
478 Views

We have just switched from Compaq to Intel fortran compiler and then we have a problem with !DEC$ Attributes.

The code looks like this: (first 2 lines that give problems)

INTEGER FUNCTION ISPLNK(COMMAND,VARNAME,VARIAB,VARTYPE,VARLEN)

!DEC$ ATTRIBUTES C, varying :: ISPLNK

When I compile I get the following error message:

error #7310: The DEC$ ATTRIBUTES VARYING specifier can be used in an interface block for an explicit interface for a C/C++ routine or for a variable declared EXTERNAL that represents a C/C++ routine. [ISPLNK]

compilation aborted for C:\Data\chwo\Ongoing\Ångturbin\Martin\Isplnk.f90 (code 1)

 

I tested this code in version 11.1.065 and it did compile without any problem.

 

What has happened in version 12.04.196 (and above)?

 

0 Kudos
1 Reply
mecej4
Honored Contributor III
478 Views
I do not see the purpose of specifying the VARYING attribute for a function name when the body of the function code is itself in Fortran. This attribute is intended to enable one to call (from Fortran code) a C routine that accepts a variable number of arguments. In particular, the attribute tells the compiler not to flag seemingly erroneous (in that the number of arguments are inconsistent) multiple invocations of the function from a single Fortran subprogram. Since the specification of VARYING in this context serves no purpose, a simple fix is to remove that attribute from your code, and accept that the 2013 compiler is less forgiving than older versions towards inappropriate directives. Fortran 90+ allows OPTIONAL arguments, but the rules and ideas behind that are quite different from those behind C functions with a variable number of arguments.
0 Kudos
Reply