02.07.2014 Views

Intel(R) Fortran Compiler for Linux* Systems User's Guide Volume I ...

Intel(R) Fortran Compiler for Linux* Systems User's Guide Volume I ...

Intel(R) Fortran Compiler for Linux* Systems User's Guide Volume I ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Intel</strong>® <strong>Fortran</strong> <strong>Compiler</strong> <strong>for</strong> <strong>Linux*</strong> <strong>Systems</strong> <strong>User's</strong> <strong>Guide</strong> <strong>Volume</strong> I: Building<br />

Applications<br />

can specify these conventions in a mixed-language interface with the<br />

INTERFACE statement or in a data or function declaration. C/C++ and <strong>Fortran</strong><br />

both pass arguments in order from left to right.<br />

2. The caller routine and the called routine use a calling convention to select the<br />

option of passing a variable number of arguments.<br />

3. The caller routine and the called routine use a calling convention to pass<br />

arguments by value (values passed) or by reference (addresses passed). Individual<br />

<strong>Fortran</strong> arguments can also be designated with ATTRIBUTES option VALUE or<br />

REFERENCE.<br />

4. The caller routine and the called routine use a calling convention to establish<br />

naming conventions <strong>for</strong> procedure names. You can establish any procedure name<br />

you want, regardless of its <strong>Fortran</strong> name, with the ALIAS directive (or<br />

ATTRIBUTES option ALIAS). This is useful because C is case-sensitive, while<br />

<strong>Fortran</strong> is not.<br />

See these topics:<br />

ATTRIBUTES Properties and Calling Conventions<br />

<strong>Fortran</strong>/C Calling Conventions<br />

ATTRIBUTES Properties and Calling<br />

Conventions<br />

The ATTRIBUTES properties (also known as options) C, REFERENCE, VALUE,<br />

and VARYING all affect the calling convention of routines. You can specify the:<br />

• C, REFERENCE, and VARYING properties <strong>for</strong> an entire routine<br />

• VALUE and REFERENCE properties <strong>for</strong> individual arguments<br />

By default, <strong>Fortran</strong> passes all data by reference (except the hidden length<br />

argument of strings, which is passed by value). If the C property is used, the<br />

default changes to passing almost all data except arrays by value. However, in<br />

addition to the calling-convention property C, you can specify argument<br />

properties VALUE and REFERENCE (to pass arguments by value or by<br />

reference), regardless of the calling convention property. Arrays can only be<br />

passed by reference.<br />

Different <strong>Fortran</strong> calling conventions can be specified by declaring the <strong>Fortran</strong><br />

procedure to have certain attributes. Assume this example:<br />

INTERFACE<br />

SUBROUTINE MY_SUB (I)<br />

182

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!