[Trilinos-Users] Fortran name mangling

Alireza Nejadmalayeri Alireza.Nejadmalayeri at Colorado.EDU
Mon Dec 13 21:02:02 MST 2010


Hello,

I have been trying to compile a simple mixed Fortran/CC code using makefile build system, but it is not going so well. 
I would appreciate any advice on how to debug this problem:

1) I have just 2 source files:   Fortran_calls__Trilinos_CC_Interface.f90   &  Trilinos_Interface.cpp

2) Trilinos_Interface.cpp  contains a function,  void Trilinos_Interface(...)  , which is communicating with Trilinos

3) Inside Fortran_calls__Trilinos_CC_Interface.f90,     Trilinos_Interface(...)   is called

4) Inside Trilinos_Interface.cpp,  I have defined:
#define Trilinos_Interface  trilinos_interface_

5) And the build part of the makefile:

MyApp.exe: libmyappLib.a

 mpif90 $(FORT_FLAGS) $(LINK_FLAGS) $(INCLUDE_DIRS) $(DEFINES) $(LIBRARY_DIRS) libmyappLib.a $(LIBRARIES) Fortran_calls__Trilinos_CC_Interface.f90 -o MyApp.exe

libmyappLib.a: Trilinos_Interface.o
 $(Trilinos_AR) cr libmyappLib.a Trilinos_Interface.o

Trilinos_Interface.o:
 $(CXX) -c $(CXX_FLAGS) $(INCLUDE_DIRS) $(DEFINES) Trilinos_Interface.cpp

The reason I use mpif90 is that  $FORT  is  mpif77, though I think there is no difference here.

6)
But I am getting this:

/tmp/iforteBcFzw.o: In function `fortran_calls_c':
/usr/rmt_share/scratch95/a/alireza/The_Trilions_Project/Trilinos_Users/TrilinosUsers__EpetraOperatorAztecOO__FcallsCC2/Fortran_calls__Trilinos_CC_Interface.f90:270: undefined reference to `trilinos_interface_'
make: *** [MyApp.exe] Error 1

7)
Besides, I notice "lower under" mangling while configuring:

FORTRAN_MANGLING: Bingo!  LOWER UNDER is the correct fortran name mangling!

-- Fortran name mangling: LOWER UNDER
-- Detecting Fortran/C Interface

Thank you,
alireza
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20101213/974c0d46/attachment.html 


More information about the Trilinos-Users mailing list