Hello R-world!

This is my first post to the R list, so I feel that I need to say thanks to
the community (I'm using R now for 5 months)!

I'd greatly appreciate if somebody could explain some odd behavior of
".Fortran" to me. Let's assume a primitive Fortran subroutine

barfoo.f
----------------------------
      subroutine bar(y, v)
      double precision y
      real v

      y = 1.455523
      v = 3.2

      end
----------------------------

after $ R CMD SHLIB barfoo.f (uses gfortran & gcc), I switch to R-2.6.2
R> dynload("barfoo.so")
R> .Fortran("bar", y=as.double(3), v=as.real(2.1))
$y
[1] 1.455523

$v
[1] 2.099999
--------------
the double value of y changes according to the programme, but the v value is
not being updated (besides an error is made).

The reason why I"m interested is because I want to run an elaborate Fortran
programme within a MCMC in R. All arguments for the programme are 'real'.
Could somebody explain to me what's going on? Also, feel free to try that on
your machine.

thanks very much in advance,
Sebastian

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to