fortran90 - How to use Fortran 77 subroutines in Fortran 90/95? -


i'm writing code fortran 90 , need use special functions in the*amos fotran 77 library(http://www.netlib.org/amos/). found module interface routines(https://github.com/certik/fortran-utils/blob/master/src/amos.f90).

my question is: how can combine them , use them in fortran 90 program , how compile them correctly?

i have been struggling 1 whole day , still not figure out.

the following test code:

program test_zbesi use set_precisions use amos implicit none integer :: n, i, nz, ierr !double precision :: zr,zi, cyr(5), cyi(5) real(kind=dbl) :: zr, zi, cyr(5), cyi(5)  n=5 zr=1.0_dbl zi=2.0_dbl  call zbesi(zr,zi,0.0_dbl,1,n,cyr,cyi,nz,ierr) print *,' ' i=1, n    write(*,10) i-1, cyr(i)    write(*,11) i-1, cyi(i) end print *,' nz=', nz print *,' error code:', ierr print *,' '  10 format('  zr(',i1,') = ',f10.6) 11 format('  zi(',i1,') = ',f10.6)  end program test_zbesi 

the result got following:

  zr(0) =   0.000000   zi(0) =   0.000000   zr(1) =   0.000000   zi(1) =   0.000000   zr(2) =   0.000000   zi(2) =   0.000000   zr(3) =   0.000000   zi(3) =   0.000000   zr(4) =   0.000000   zi(4) =   0.000000   nz=           0   error code:           4 

it seems not correct answer no matter how.

i tried convert zbesi.f fortran 77 code fortran 90 code hand. code long , disaster.

with extremely few exceptions, fortran 77 subset of fortran 90/95/2003/2008. , in practice, compilers still support obsolete features. compiling fortran 77 , fortran 90/59/2003/2008 source same compiler should produce compatible object modules. have compile 2 language versions separately since different compiler options necessary, e.g., fixed , free-form source layout. interfaces in fortan 90/95/2003/2008 code, compiler use compatible calling conventions.

what specific problems having? need know compiler options fortran 77? compiler using?

edit: have compile module before source code uses it. convenient compile fortran 77 first, object file, , use fortran command compiles fortran 95 link everything. try:

ifort -c -fixed zbesi.f ifort zbesi.o set_precisions.f90 amos.f90 test_zbesi.f90. 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -