The ChipList, by Adrian Offerman; The Processor Portal

new
Processor Selector

Platform:
Segment:
View: show / edit

bookmark bookmark site
bookmark permalink
Tue 5 Jun 2012, 6:00

Replacing Intel Fortran ATTRIBUTES with C Interoperability Features


Replacing Intel Fortran ATTRIBUTES with C Interoperability Features
For many years, Fortran programmers have used vendor extensions to facilitate programming that mixes code written in Fortran and C. The Fortran 2003 standard defined new language features for C interoperability, and in many cases these can be used instead of vendor extensions.

This article lists, for each Intel Fortran extension commonly used for mixed-language programming, the corresponding standard Fortran syntax, if any. Please note that existing code will continue to work, but we encourage you to use the standard syntax when writing new code.

ATTRIBUTES ALIAS

Use BIND(C,NAME="alias-name"). The BIND(C) syntax also implies ATTRIBUTES DECORATE - the compiler applies whatever name decoration (leading or trailing underscores) that C would use for the exact same name.  Note that if the NAME= clause is omitted, Fortran will use the Fortran name converted to lowercase on all platforms.

For example, instead of:

INTERFACE
  SUBROUTINE CSUB
  !DEC$ ATTRIBUTES DECORATE, ALIAS:"CSub" :: CSUB
  END SUBROUTINE
END INTERFACE
You could use:
INTERFACE
  SUBROUTINE CSUB () BIND(C,NAME="CSub")
  END SUBROUTINE CSUB
END INTERFACE
Note that if the procedure has no arguments, you must indicate that with () when adding BIND. Also, all arguments to a routine ...
Filed under: Intel® Fortran Compiler for Linux* Knowledge BaseIntel® Fortran Compiler for Mac OS X* Knowledge BaseIntel® Visual Fortran C
Also published by:

ChipList news channel Last Months News


ChipList developers news channel Last Months Developers News


Page viewed 312 times since Wed 6 Jun 2012, 22:42.