Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://crydee.sai.msu.ru/f90/c15.html
Дата изменения: Sat Mar 30 11:25:46 1996 Дата индексирования: Mon Oct 1 19:44:58 2012 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п п п п |
The two main numerical libraries in Fortran 90 are
Both of these offer both a modified version of the Fortran 77 library, recompiled for Fortran 90, and a completely new library, using all the new facilities of Fortran 90.
Method 1.
A simple method is to recompile the
Fortran 77 routines
with the Fortran 90 compiler using fixed form. This should work since
Fortran 77 is a pure subset of Fortran 90. The problem is that the
library does not always exactly follow the standard. NAG recognizes
specifically that although the data type DOUBLE PRECISION COMPLEX or
COMPLEX*16 is not in the standard, it is in many implementations of
Fortran 77. A subprogram which uses this extension therefore has to be
modified. Also possible assignments of binary, octal or hexadecimal
constants is difficult since they are standardized only in Fortran
90. Also note that the very common notation REAL*8 for
DOUBLE
PRECISION is not permitted in Fortran 90.
Method 2.
The second method is to link the
Fortran 77 library
directly with the Fortran 90 programs. The practical problem was
previously that the NAG's Fortran 90 system f90 under version 1.1 did
not include support for linkage of libraries, therefore you first had
to compile with the Fortran compiler using f90 -c and then link with
the C compiler using cc. NAG recommended the following commands
f90 -c test.f cc test.o -lnag -o a.out /usr/local/lib/f90/f90rt0.o\ /usr/local/lib/f90/libf90.a -lI77 -lF77 - lmwhich worked on Sun after that we had removed -lI77 since we did not find this library on the system here in Linköping.
From version 1.2 it is much simpler because linkage support is now included and on the Sun you only give the following command
f90 test.f -lnag - lF77while on DEC ULTRIX (MIPS) you give the command
f90 test.f lnag -lfor -lutil -li -lotsThus a few more libraries have to be included on the DEC.
In addition to the problems mentioned above we can also note that Fortran allows routine names as arguments, which may be treated differently in the NAG's Fortran 90 compiler based on translation to C and in the existing Fortran 77 compiler. There is therefore a danger for linkage errors.
On the Sun using Sun OS 4.2.1 we also got completely wrong results when using library functions in single precision, since the C system on Sun converted all function calls into double precision. NAG has solved this problem in release 2.1.
The method can thus be used when neither complex variables in double precision nor routine names are used as arguments, and provided that you are not using single precision library functions on a system which incorrectly converts the calls to double precision.
It is very essential to get all the required libraries at the linkage process, those are for example the mathematical libraries in Fortran 77, Fortran 90 and C. Sometimes the libraries have to be given in the correct order.