Try R CMD SHLIB test.f If SHLIB know it has to deal with Fortran code, it adds the appropriate libraries. On Wed, 26 May 2004, Gilles GUILLOT wrote:> I have the following Fortran code > > subroutine sub(path) > character*100 path > open(10,file=path) > end > > saved as test.f > > which I compile with > g77 -c test.f > > then I make the shared libary in R (Version 1.9.0) with > system("R CMD SHLIB test.o") > > so far, everything OK. > > But > dyn.load("test.so") > returns the following error message: > Error in dyn.load(x, as.logical(local), as.logical(now)) : > unable to load shared library "test.so": > test.so: undefined symbol: f_open > > I get similar error messages with r/w Fortran instructions like > write(*,*) , read(*,*) > > I used to use such programs on my computer under mandrake linux 10. > The problem reported occurs on a new server operating under > another linux distrib (debian). > > Thanks in advance for any help, > Gilles >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
I have the following Fortran code subroutine sub(path) character*100 path open(10,file=path) end saved as test.f which I compile with g77 -c test.f then I make the shared libary in R (Version 1.9.0) with system("R CMD SHLIB test.o") so far, everything OK. But dyn.load("test.so") returns the following error message: Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library "test.so": test.so: undefined symbol: f_open I get similar error messages with r/w Fortran instructions like write(*,*) , read(*,*) I used to use such programs on my computer under mandrake linux 10. The problem reported occurs on a new server operating under another linux distrib (debian). Thanks in advance for any help, Gilles -- _____________________________________________________________________ Gilles GUILLOT INRA -D??partement Math??matiques et Informatique Appliqu??es Unit?? de Mixte de Recherche INRA - INAPG - ENGREF Institut National Agronomique de Paris-Grignon 16 rue Claude Bernard 75231 Paris cedex 5 Aile Claude Bernard Niveau cours +3 ??tages tel : +33 (0)1 44 08 72 71 fax : +33 (0)1 44 08 16 66 http://www.inapg.fr/ens_rech/mathinfo/personnel/guillot/welcome.html
It works with R CMD SHLIB test.f Thanks. Gilles> Try > > R CMD SHLIB test.f > > If SHLIB know it has to deal with Fortran code, it adds the appropriate > libraries. > > On Wed, 26 May 2004, Gilles GUILLOT wrote: > > I have the following Fortran code > > > > subroutine sub(path) > > character*100 path > > open(10,file=path) > > end > > > > saved as test.f > > > > which I compile with > > g77 -c test.f > > > > then I make the shared libary in R (Version 1.9.0) with > > system("R CMD SHLIB test.o") > > > > so far, everything OK. > > > > But > > dyn.load("test.so") > > returns the following error message: > > Error in dyn.load(x, as.logical(local), as.logical(now)) : > > unable to load shared library "test.so": > > test.so: undefined symbol: f_open > > > > I get similar error messages with r/w Fortran instructions like > > write(*,*) , read(*,*) > > > > I used to use such programs on my computer under mandrake linux 10. > > The problem reported occurs on a new server operating under > > another linux distrib (debian). > > > > Thanks in advance for any help, > > Gilles-- _____________________________________________________________________ Gilles GUILLOT INRA -D??partement Math??matiques et Informatique Appliqu??es Unit?? de Mixte de Recherche INRA - INAPG - ENGREF Institut National Agronomique de Paris-Grignon 16 rue Claude Bernard 75231 Paris cedex 5 Aile Claude Bernard Niveau cours +3 ??tages tel : +33 (0)1 44 08 72 71 fax : +33 (0)1 44 08 16 66 http://www.inapg.fr/ens_rech/mathinfo/personnel/guillot/welcome.html