[Rd] Use of PKG_FFLAGS on Windows

Hotz, T. th50 at leicester.ac.uk
Thu Jul 3 15:01:24 MEST 2003


Dear all,

After reading the manuals (especially R-exts) I haven't found 
an answer to the following question yet.

I was compiling someone else's Fortran routines to make them 
available with R. Hear, I should not that I don't know anything 
about Fortran, and I only tried to built a shared library.

Linux being my platform of choice when developing for R, I first 
got everything done there, using R CMD COMPILE, and R CMD SHLIB. 
Since g77 complained about the Fortran Codes indentation style, 
I assumed (after reading g77's manpage) that the Fortran code is 
given in free-form dialect. Therefore, I added a line 
PKG_FFLAGS+= -ffree-form to Makevars. Compilation and building 
went fine and I successfully accessed the routines using dyn.load 
and .Fortran.

My colleague, who wanted this done, runs R under windows. So I 
learnt how to build a package under windows (readme.packages is a 
great guide!), and it went all smoothly, except: option -free-form 
no longer was passed to g77 (from Rtools), which caused compilation 
to fail. Renaming Makevars to Makevars.win did not help.

Investigating this in more detail, I found that MakeDLL contains 
the line
<snip>
FFLAGS=-O2 $(DEBUGFLAG)
<snip>
so PKG_FFLAGS weren't used at all. Changing this line to
<snip>
FFLAGS=$(PKG_FFLAGS) -O2 $(DEBUGFLAG)
<snip>
resolved the problem, however. I subsequently was again able to access 
the routines of the built library.

My question now is: is this behaviour intended, and, if so, why? I am 
curious only because I might want to make this package freely 
available, and wouldn't like to ask people to change MakeDLL which I 
assume was written that way for good reasons. If the change in 
MakeDLL is not necessary, how do I then pass a compiler option to g77?

Any comments and suggestions are very welcome. I hope my minor 
knowledge has not raised problems to far off-topic. Thanks  in advance 
for your time and help.

Best wishes

Thomas

---

> version
         _              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    7.1            
year     2003           
month    06             
day      16             
language R 

---

Thomas Hotz
Research Associate in Medical Statistics
University of Leicester
United Kingdom

Department of Epidemiology and Public Health
22-28 Princess Road West
Leicester
LE1 6TP
Tel +44 116 252-5410
Fax +44 116 252-5423

Division of Medicine for the Elderly
Department of Medicine
The Glenfield Hospital
Leicester
LE3 9QP
Tel +44 116 256-3643
Fax +44 116 232-2976



More information about the R-devel mailing list