[Trilinos-Users] Fortran name mangling
Baker, Christopher G.
bakercg at ornl.gov
Tue Dec 14 03:54:40 MST 2010
Try looking at libmyappLib.a so see what the symbol is called:
nm libmyappLib.a | grep -i trilinos_interface
Also, it won't hurt to verify what the Fortran compiler is doing:
mpif90 $(FORT_FLAGS) $(INCLUDE_DIRS) $(DEFINES) -c Fortran_calls_Trilinos_CC_Interface.f90
nm Fortran_calls_Trilinos_CC_Interface.o | grep -i trilinos_interface
Chris
On 12/13/10 11:02 PM, "Alireza Nejadmalayeri" <Alireza.Nejadmalayeri at colorado.edu<mailto:Alireza.Nejadmalayeri at colorado.edu>> wrote:
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
More information about the Trilinos-Users
mailing list