[R] R-Fortran question (multiple subroutines)

Duncan Murdoch murdoch.duncan at gmail.com
Mon Oct 25 12:52:15 CEST 2010


Remko Duursma wrote:
> Dear R-helpers,
> 
> 
> apologies if this is somewhere in a manual, I have not been able to
> find anything relevant. I run Windows Vista.
> 
> I have some Fortran code in a subroutine, and have no problem calling
> this from R with .Fortran, compiling the code either with 'R CMD
> SHLIB' or independently with gfortran.
> 
> But is it possible to have more than one subroutine in my source file,
> one depending on the other? Or is this not supported, or is there a
> trick?
> Of course, I could rewrite my code, but there are lots of subroutines...
> 
> I.e, my code looks something like this:
> 
> subroutine f(x,y,z)
> 
> call g(x,y,z)
> 
> end
> 
> subroutine g(x,y,z)
> 
> z = x*y
> 
> end
> 
> 
> calling this from R shows that subroutine g is not called. The code
> compiled as executable works fine.

There are no such limitations imposed by R.  I'd suggest your diagnosis 
of the problem is wrong.  If you can't spot the problem, please post a 
real example (simplified if possible, but not as much as the one above).

Duncan Murdoch

> 
> 
> thanks,
> Remko
> 
> 
> 
> 
> -------------------------------------------------
> Remko Duursma
> Research Lecturer
> 
> Centre for Plants and the Environment
> University of Western Sydney
> Hawkesbury Campus
> Richmond NSW 2753
> 
> Mobile: +61 (0)422 096908
> www.remkoduursma.com
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list