Re: g77/gfortran incompatibilities---name mangling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sean yang wrote:
I saw a same question asked on the mailing list(date back to last year), but it was not answered.

Can I somehow make the code compiled by gfortran compatible to the code compiled by g77? Because symbol name in lots of libraries are g77 compitable. Here is a concrete example,

I tried to compile the following mpi programs with g77(the fotran compiler under the directory /usr/bin on my machine) and gfotran (the fortran compiler I generated from gcc 4.0.2)
#/usr/bin/g77 -c test.f
#nm test.o
00000029 T MAIN__
        U mpi_comm_rank__
        U mpi_comm_size__
        U mpi_finalize__
        U mpi_init__


#/home/gcc402/bin/gfortran -c test.f
#nm test.o
00000000 T MAIN__
        U mpi_comm_rank_
        U mpi_comm_size_
        U mpi_finalize_
        U mpi_init_
--------------------test.f-------------
       program main

     include 'mpif.h'

     double precision  PI25DT
     parameter        (PI25DT = 3.141592653589793238462643d0)

     double precision  mypi, pi, h, sum, x, f, a
     integer n, myid, numprocs, i, rc
c                                 function to integrate
     f(a) = 4.d0 / (1.d0 + a*a)

     call MPI_INIT( ierr )
     call MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
     call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )

30   call MPI_FINALIZE(rc)
     stop
     end
AFAIK, every version of MPI includes a system for adapting to the default underscore-appending scheme of gfortran. That scheme would be preferable to use of the second_underscore option. In either case, you'll have to break out TFM. If you are trying to combine g77 and gfortran, don't. Several versions of MPI also have FAQs and help lists of their own.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux