Greetings all,
I am trying to work my way through calling FORTRAN from ROOT and figured that working through Rene’s simple example was the best starting point. The only deviations from Rene’s example were because of changes to some compiler syntax - but I followed it as closely as possible.
I have tried compiling the files using the following options
[quote]gfortran -c -fPIC myf77.f
g++ -Wl,-soname,libmyf77.so -shared -o libmyf77.so myf77.o
[/quote]
I could not use g77 as it has been deprecated in my Linux version. The switch -lg2c could not be used because it has been deprecated and the documentation says that it is unnecessary for gfortran. The switch -fPIC was necessary in order to get the object code to work with g++. The shared object compiled without a problem but when I started a root session and tried to follow the directions for invoking this I got the following
[quote]
root [0] gSystem->Load(“libmyf77”)
(int)0
root [1] .L myc2f77.C++
Info in TUnixSystem::ACLiC: creating shared library /home/TestCallFortran/./myc2f77_C.so
root [2] myc2f77(2,6)
/usr/bin/root.exe: symbol lookup error: /home/TestCallFortran/./libmyf77.so: undefined symbol: _gfortran_st_write[/quote]
I have also tried using the Intel Fortran compiler as follows
[quote]source /opt/intel/Compiler/11.0/074/bin/ifortvars.sh intel64
ifort myf77.f -shared -fPIC -c
g++ -Wl,-soname,libmyf77.so -shared -o libmyf77.so myf77.o [/quote]
I get the following [quote]
root [0] gSystem->Load(“libmyf77”)
(int)0
root [1] .L myc2f77.C++
Info in TUnixSystem::ACLiC: creating shared library /home/TestCallFortran/./myc2f77_C.so
root [2] myc2f77(2,6)
/usr/bin/root.exe: symbol lookup error: /home/TestCallFortran/./libmyf77.so: undefined symbol: for_write_seq_lis[/quote]
I have also experimented with a variety of other command line switches and the Intel C++ compiler rather than g++. In most cases these fail at the command “gSystem->Load(“libmyf77”)”.
My ROOT version details are as follows:
ROOT 5.18/00b (branches/v5-18-00-patches@22563, Apr 06 2010, 02:11:00 on linuxx8664gcc)
CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
The Intel Fortran compiler is version l_cprof_p_11.0.074
Any guidance or help you can give on where I am going wrong or what to do next will be greatly appreciated.
Regards
myc2f77.C (172 Bytes)
myf77.txt (186 Bytes)