Re: Root macro call Fortran subroutines

From: Weijun Guo <>
Date: Wed, 30 Aug 2006 08:24:11 -0500


I tried to follow a discussion between Rene Brun and smith277 on a thread: fortran+code

On my PC (windows xp), I have ROOT installed with the Windows Installer Packages, Cygwin packages (g++, f77, etc.), Compaq Visual Fortran
(6.5), and Visual Studio .Net 2002(7.0).

In that thread, Rene Brun described the following procedure:

a simple example with a fortran file myf77.f function myf77(arg1,arg2)
integer arg1
double precision arg2,myf77
myf77 = arg1*sqrt(arg2)
print *, 'arg1=',arg1,' arg2=',arg2, ' myf77=',myf77 end

Create a small shared lib
g77 -c myf77.f
g++ -Wl,-soname, -shared -o myf77.o -lg2c

a simple C++ file myc2f77.C calling this f77 function #define myf77 myf77_
extern "C" double myf77(int &arg1, double &arg2); void myc2f77(int arg1, double arg2) {
double res = myf77(arg1,arg2);

Now a simple ROOT session

root > gSystem->Load("libmyf77") 
root > .L myc2f77.C+ 
root > myc2f77(2,6)


I got the libmyf77.lib compiled successfully, but when I type in:


ROOT was complaining about not finding the library, which does exist in the working directory. The error is as following:

Error in <TWinNTSystem::DynamicPathName>: libmyf77 does not exist in .;C:\root\/bin;C:\NuTCROOT\bin; C:\NuTCROOT\bin\X11;C:\NuTCROOT\mksnt; C:\root\bin; C:\VSNET02\Common7\IDE; (...and a lot of other directories, I took them out to shorten the message...) , or has wrong file extension

I guess this is due to some possible incompatible factors between my windows version of ROOT and g77 compiler. Could someone possibly help me out on this?



This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message. Received on Wed Aug 30 2006 - 15:26:19 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET