From edd at debian.org  Tue Dec 14 23:00:12 2010
From: edd at debian.org (Dirk Eddelbuettel)
Date: Tue, 14 Dec 2010 16:00:12 -0600
Subject: [Rd] How to specify compiler options when using R CMD SHLIB
In-Reply-To: <OFB3963020.794B5282-ON872577F9.006FE2D3-872577F9.00703E23@usgs.gov>
References: <OFB3963020.794B5282-ON872577F9.006FE2D3-872577F9.00703E23@usgs.gov>
Message-ID: <19719.59628.328369.100289@max.nulle.part>


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
| 
| R CMD SHLIB MRPP.f90. 
| 
| So I was wondering if anyone could tell me how compiler option should be 
| specified when using R CMD SHLIB?

I use 

  ~/.R/Makevars 

where you can set all variables your in in 

  $RHOME/etc/Makeconf

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

Dirk

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



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