Problem to call fortran from C with linux ifc/gcc

From: Ben (broger_at_oreka.com)
Date: 12/09/03


Date: 9 Dec 2003 14:40:15 GMT

Hello,

I tried without succes to call a Fortran subroutine with a C program in
a very simple program:

mod_fortran.f90:
module mod_fortran
  public :: fct_fortran
  contains
     subroutine fct_fortran()
         print *,"FORTRAN"
     end subroutine fct_fortran
end module mod_fortran
--------------------------------------
test.c :
main() {
fct_fortran();
}
---------------------------------------

To compile I used
ifc -c -nus mod_fortran.f90
cc -c test.c
ifc test.o mod_fortran.o

and I get the error compilation :

undefined reference to `fct_fortran'

I tried to see the reference in the .o:

nm test.o :
        U fct_fortran

nm mod_fortran.o:
00000000 T mod_fortran..fct_fortran

Someone has an idea to compile my program ? It seems that the program ca
n't make the link between mod_fortran..fct_fortran and fct_fortran ...

Regards

Ben

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Article poste via Voila News - http://www.news.voila.fr
Le : Tue Dec 9 15:40:15 2003 depuis l'IP : icare-pc2.univ-lille1.fr [VIP 403146271547]