[Trilinos-Users] Fortran name mangling

Alireza Nejadmalayeri Alireza.Nejadmalayeri at Colorado.EDU
Tue Dec 14 11:34:15 MST 2010


Thanks, Chris. Here is what   "nm Fortran_calls__Trilinos_CC_Interface.o | grep -i trilinos_interface"  returns:
     U trilinos_interface_

And    nm libmyappLib.a | grep -i trilinos_interface  :
     Trilinos_Interface.o:
     0000000000000050 T _Z19trilinos_interface_PiS_
     0000000000000018 r _Z19trilinos_interface_PiS_$$LSDA

Could you please advise on these.

Thank you,
alireza


----- Original Message ----- 
From: "Baker, Christopher G." <bakercg at ornl.gov>
To: "Alireza Nejadmalayeri" <Alireza.Nejadmalayeri at colorado.edu>; <trilinos-users at software.sandia.gov>
Sent: Tuesday, December 14, 2010 2:54 AM
Subject: Re: [Trilinos-Users] Fortran name mangling


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20101214/621e28e4/attachment.html 


More information about the Trilinos-Users mailing list