ROOT and shared library problem

Hi ROOT-ers - I wander if anybody has a few minutes to look at the problem
I am encountering when trying to use the shared library in ROOT.

In short, I have a long(-ish) F77 code that defines a complicated matrix element:
MATRIX_PI_ENUEE.f (attachent 1)

Because I am trying to save time and not retype the program in C++, I make a shared library:

g77 -c -fPIC MATRIX_PI_ENUEE.f
g++ -Wl,-soname,libMATRIX_PI_ENUEE.so -shared -o libMATRIX_PI_ENUEE.so MATRIX_PI_ENUEE.o

That gets me the file libMATRIX_PI_ENUEE.so

Then I want to use the function matrix_pi_enuee() in my ROOT program
gen_pienuee.C (attachemnet 2). I get error:

root [1] gSystem.Load(“libMATRIX_PI_ENUEE.so”)
(int)0
root [2] .x gen_pienuee.C+
Info in TUnixSystem::ACLiC: creating shared library /net/research/pocanic/ef2p/anal2339_09s/./gen_pienuee_C.so
/net/research/pocanic/ef2p/anal2339_09s/./gen_pienuee.C: In function ‘void gen_pienuee()’:
/net/research/pocanic/ef2p/anal2339_09s/gen_pienuee_C_ACLiC_dict.o: In function G__gen_pienuee_C_ACLiC_dict__0_1297(G__value*, char const*, G__param*, int)': gen_pienuee_C_ACLiC_dict.cxx:(.text+0x790): undefined reference tomatrix_pi_enuee_’
/net/research/pocanic/ef2p/anal2339_09s/gen_pienuee_C_ACLiC_dict.o: In function gen_pienuee()': gen_pienuee_C_ACLiC_dict.cxx:(.text+0x255f): undefined reference tomatrix_pi_enuee_’
collect2: ld returned 1 exit status
Error in : Compilation failed!
Error: Function gen_pienuee() is not defined in current scope :0:
*** Interpreter error recovered ***

Cheers, Emil

P.S. I tried various modifications without success…
gen_pienuee.C (4.64 KB)
MATRIX_PI_ENUEE.f (18 KB)

The STAR experiment -> How to use FORtran from a ROOT macro
ROOT HowTo’s -> How to Call CERNLIB Routines from the Interpreter ?

Try to add “-fno-automatic -fno-second-underscore” to the “g77” invocation line (also, I think it should be “g77” which builds your shared library, not “g++”).

BTW: It should be: root [1] gSystem->Load(“libMATRIX_PI_ENUEE”)