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

Is there a way to ignore !DEC$ directives.

epasveer
Beginner
761 Views

Hi All,

Is there a way to tell the compiler to ignore the !DEC$ directives?

!DEC$ ATTRIBUTES C :: anmo_ray_trace

The above directive suppresses the training '_' and I'd like to tell the compiler to ignore the DEC statement so that I
can control the trailing '_' with the -us option.

THanks,

0 Kudos
4 Replies
TimP
Honored Contributor III
761 Views

You might use the pre-processor facility to make text substitutions, so that the directives become meaningless comments.

ifort -DDEC=comment yourfile.F

I do use -us sometimes, but I feel guilty about using it for cross-language linking, where ISO C interop is a better way.

0 Kudos
Steven_L_Intel1
Employee
761 Views

There is no option to disable directives. Please do not use -us. As Tim suggests, use BIND(C,NAME="string") or !DEC$ ATTRIBUTES ALIAS.

0 Kudos
epasveer
Beginner
761 Views

There is no option to disable directives. Please do not use -us. As Tim suggests, use BIND(C,NAME="string") or !DEC$ ATTRIBUTES ALIAS.

The problem is we have a lot of legacy C/C++ code that calls the f90 routine with the trailing '_'. Changing the C/C++ code isn't a choice.

Can you explain whatBIND(C,NAME="string") is and where I should put the directive.

Thanks,

0 Kudos
Steven_L_Intel1
Employee
761 Views

BIND(C) is a feature from Fortran 2003, supported by Intel Fortran 10.0 and later, and specifies that a procedure, type or object is "interoperable with C". In your case, you would do something like:

subroutine ammo_ray_trace (arguments) BIND(C,NAME="ammo_ray_trace_")

Spell the NAME= string exactly as it is spelled in C - do not add any characters not present in the C code.

0 Kudos
Reply