24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

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.

Answers to Frequently Asked Questions<br />

Finding the Date and Time<br />

Efficient Static Linking<br />

Here are the answers to some questions that are often asked by users of <strong>XL</strong><br />

<strong>Fortran</strong>. Many of these questions are answered elsewhere in the <strong>XL</strong> <strong>Fortran</strong><br />

documentation, but they are also collected here <strong>for</strong> your convenience.<br />

There are some common date and time subprograms that you may be familiar<br />

with from programming in FORTRAN 77 on other systems. <strong>XL</strong> <strong>Fortran</strong> provides<br />

equivalents to many of these subprograms. Some of the names have trailing<br />

underscores to avoid conflicts with C library functions of the same name.<br />

The <strong>XL</strong> <strong>Fortran</strong> subprograms that deal with the date and time are:<br />

alarm_<br />

clock_<br />

ctime_<br />

date<br />

dtime_<br />

etime_<br />

fdate_<br />

gmtime_<br />

idate_<br />

irtc<br />

itime_<br />

jdate<br />

ltime_<br />

rtc<br />

sleep_<br />

time_<br />

timef<br />

usleep_<br />

See the section on Service and Utility Procedures in the <strong>XL</strong> <strong>Fortran</strong> <strong>Enterprise</strong> <strong>Edition</strong><br />

<strong>for</strong> <strong>AIX</strong> Language Reference <strong>for</strong> details about these subprograms.<br />

For portable <strong>Fortran</strong> 90 and <strong>Fortran</strong> 95 programming, you can also use the<br />

CPU_TIME, DATE_AND_TIME, and SYSTEM_CLOCK intrinsic subroutines.<br />

“Dynamic and Static Linking” on page 46 discusses the respective strengths and<br />

weaknesses of static and dynamic linking. A technique <strong>for</strong> static linking that<br />

requires relatively little disk space is to link any <strong>XL</strong> <strong>Fortran</strong> libraries statically but<br />

leave references to other system libraries dynamic. This example statically links just<br />

the <strong>XL</strong> <strong>Fortran</strong> library:<br />

# Build a temporary object:<br />

ld -r -o libtmp.o -bnso -lxlf90<br />

# Build the application with this object on the command line:<br />

xlf95 -o appl appl1.o appl2.o libtmp.o<br />

© Copyright <strong>IBM</strong> Corp. 1990, 2004 403

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

Saved successfully!

Ooh no, something went wrong!