[Rd] Use of PKG_FFLAGS on Windows
th50 at leicester.ac.uk
Thu Jul 3 15:01:24 MEST 2003
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
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
so PKG_FFLAGS weren't used at all. Changing this line to
FFLAGS=$(PKG_FFLAGS) -O2 $(DEBUGFLAG)
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.
system i386, mingw32
Research Associate in Medical Statistics
University of Leicester
Department of Epidemiology and Public Health
22-28 Princess Road West
Tel +44 116 252-5410
Fax +44 116 252-5423
Division of Medicine for the Elderly
Department of Medicine
The Glenfield Hospital
Tel +44 116 256-3643
Fax +44 116 232-2976
More information about the R-devel