On Fri, May 6, 2011 at 4:04 PM, Paul Gilbert <pgilb...@bank-banque-canada.ca> wrote: > Is it possible in R to call a fortran routine that sets variables in a common > block and expect the values to persist when a call is made from R to a second > routine that uses the common block? > > If not (as I suspect), is it possible to use a common block in a group of > routines that are used together, for as long the routines do not return to R?
Simple test seems to confirm it. Here's some 'tran with a setter and a getter: comchk.f: subroutine bar(n) common /c/ i i=n end subroutine geti(j) common /c/ i j = i end R CMD SHLIB comchk.f > dyn.load("comchk.so") > .Fortran("bar",as.integer(9)) [[1]] [1] 9 > .Fortran("geti",as.integer(-1)) [[1]] [1] 9 Barry ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel