I used "R CMD SHLIB" to compile the fortran filename.f file and the filename.so is generated. But since in filename.f it calls another subroutine written in C, i had problem in "dyn.load" because it could not find the C subroutine. I have the .c file but don't know how to tell R about it. How should I compile when I want to call the fortran function in R which calls (FORTRAN-callable) C-code? Thanks a lot! best regards, Zhijin
On Tue, 20 Apr 2004 11:47:17 -0400 (EDT), Zhijin Wu <zwu at jhsph.edu> wrote:> I used "R CMD SHLIB" to compile the fortran filename.f file and the > filename.so is generated. But since in filename.f it calls > another subroutine written in C, i had problem in "dyn.load" because it > could not find the C subroutine. > I have the .c file but don't know how to tell R about it. > How should I compile when I want to call the fortran function in R >which calls (FORTRAN-callable) C-code?According to the help for R CMD SHLIB, this should work: R CMD SHLIB filename.f other.c Duncan Murdoch
What happens if you do R CMD SHLIB filename1.f filename2.c Does that work? -roger Zhijin Wu wrote:> I used "R CMD SHLIB" to compile the fortran filename.f file and the > filename.so is generated. But since in filename.f it calls > another subroutine written in C, i had problem in "dyn.load" because it > could not find the C subroutine. > I have the .c file but don't know how to tell R about it. > How should I compile when I want to call the fortran function in R > which calls (FORTRAN-callable) C-code? > Thanks a lot! > best regards, > Zhijin > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >