Marian K Talbert
2010-Dec-09 18:11 UTC
[Rd] How to call DBLEPR in Fortran code to be used by R
Hi I've built a dll using Fortran code and can call it by either R or Fortran. Calling by the former gives me the wrong answer and the later gives the correct answer. From what I've read, it looks like I should use the subroutines DBLEPR, INTPR and REALPR to get values to show up in R which I hope will allow me to find the error. I've downloaded the R-2.12.0.tar.gz but have been unable to find these subroutines or any examples of how to get Fortran to recognize them. Obviously when I try to compile I get undefined reference to 'dblepr_'. So I was wondering if there is some way I can specify in the makefile or possibly by building the dll using R CMD SHLIB where to find these subroutines or where else this information might need to be. I noticed in Venables book that the functionality of these subroutines can be compiler dependent but there is no specification of which compilers might work. I'm using gfortran could this be an issue? Thanks, Marian Talbert ASRC Management Servics Contracted To: US Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg C Fort Collins, CO 80526 Phone: 970-226-9108 [[alternative HTML version deleted]]
Duncan Murdoch
2010-Dec-10 13:19 UTC
[Rd] How to call DBLEPR in Fortran code to be used by R
On 09/12/2010 1:11 PM, Marian K Talbert wrote:> Hi > > I've built a dll using Fortran code and can call it by either R or > Fortran. Calling by the former gives me the wrong answer and the later > gives the correct answer.That sounds like a type problem. Are you using double precision variables?> From what I've read, it looks like I should use > the subroutines DBLEPR, INTPR and REALPR to get values to show up in R > which I hope will allow me to find the error. I've downloaded the > R-2.12.0.tar.gz but have been unable to find these subroutines or any > examples of how to get Fortran to recognize them. Obviously when I try to > compile I get undefined reference to 'dblepr_'. So I was wondering if > there is some way I can specify in the makefile or possibly by building > the dll using R CMD SHLIB where to find these subroutines or where else > this information might need to be. I noticed in Venables book that the > functionality of these subroutines can be compiler dependent but there is > no specification of which compilers might work. I'm using gfortran could > this be an issue?You should use R CMD SHLIB source.f to compile your Fortran. Does the example of dblepr in Writing R Extensions work for you? Duncan Murdoch> Thanks, > > Marian Talbert > ASRC Management Servics > Contracted To: > US Geological Survey > Fort Collins Science Center > 2150 Centre Ave., Bldg C > Fort Collins, CO 80526 > Phone: 970-226-9108 > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel