[Rd] How to specify compiler options when using R CMD SHLIB

Dirk Eddelbuettel edd at debian.org
Tue Dec 14 23:00:12 CET 2010

On 14 December 2010 at 13:25, 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.
| >From what I've read, it looks like I should use the subroutines DBLEPR, 
| INTPR and REALPR to print to the R console rather than using Fortran 
| standard I/O and that if I use the command 
| R CMD SHLIB source.f that these subroutines will automatically be found 
| (Please correct me if I'm wrong about any of this). The problem is that I 
| have to specify the gfortran compiler option -fno-range-check in order for 
| my code to compile. I've tried setting PKG_FCFLAGS=-fno-range-check in a 
| file named Makevars under the same directory as my Fortran files but this 
| doesn't seem to be the right place because R CMD SHLIB still produces 
| error messages related to integer overflow (the same error as when I run 
| gfortran -c MRPP.f90 as opposed to gfortran -c MRPP.f90 -fno-range-check) 
| when I type
| So I was wondering if anyone could tell me how compiler option should be 
| specified when using R CMD SHLIB?

I use 


where you can set all variables your in in 


Setting the as environment variables will also work by virtue of make (and
that is what the inline package does).


Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

More information about the R-devel mailing list