Thank you, Duncan. While your answers didn't quite fix my problems, I realized that I should probably "go with the flow". I installed gfortran and everything worked fine. Thanks again.
Steve sjnovick wrote: > > To all. I need your help. The big question is: How do I make an R > library with Fortran 95 files? You may assume that I am a pretty decent > programmer in both R and Fortran. I lay out a scenario and need your > help! > > I know how to make an ordinary R package and have dabbled with R + Fortran > 95 *.dll linking. I do not have a great handle on the whole Makevars file > and whatever else I might need to get things working to build a new R > package. By the way, I'm using R 2.8.1 and Windows XP (and sometimes > Linux). > > > Let's take this simple situation. Suppose I'm using Windows XP and place > the Folder for the package "Testme" in C:\Program > Files\R\R-2.8.1\src\library\Testme > > Files and folders: > > DESCRIPTION file -- I understand this file > NAMESPACE file: This one has the contents > useDynLib("Testme") > exportPattern("^[^\\.]") > > man directory: I put my *.Rd files here. I understand this part. > R directory: I put my *.R files here. One of these files calls upon a > Fortran 95 subroutine with > .Fortran("MySubroutine", var1=as.double(x), > var2=as.double(y), etc.) > I understand this part. > > src directory: I put my *.f95 files here. Also, I put a Makevars file > here. > > Suppose that I have two *.f95 files, named CalculatorModule.f95 and > ANiceSubroutine.f95. > > CalculatorModule.f95 contains a Fortran 95 module. > ANiceSubroutine.f95 uses the functions in > Calculator.Module.f95 with the "USE" command. To be consistent with my R > file (above), ANiceSubroutine.f95 contains the subroutine: "MySubroutine". > > Finally: I issue the command from a DOS Shell in the directory C:\Program > Files\R\R_2.8.1\src\gnuwin32 > > make pkg-Testme > > This results in errors. > > > > Here are the problems: > 1. The order of compilation must be f95 -c CalculatorModule.f95 > ANiceSubroutine.f95. Unfortunately, R compiles them alphabetically. So, > I was given errors making the *.o files. > > I overcame this problem by renaming the files > a01.CalculatorModule.f95 and a02.ANiceSubroutine.f95. I would rather not > have to name the files this way if I don't have to! When I did this, R > compiled the Fortran files in the correct order, but I still have errors. > > 2. Here was the error output. Help????? > > C:\Program Files\R\R-2.8.1\src\gnuwin32>make pkg-Testme > > ---------- Making package Testme ------------ > adding build stamp to DESCRIPTION > installing NAMESPACE file and metadata > making DLL ... > "g95" -O3 -c a01.CalculatorMod.f95 -o a01.CalculatorMod.o > "g95" -O3 -c a02.ANiceSubroutine.f95 -o a02.ANiceSubroutine.o > windres --preprocessor="gcc -E -xc -DRC_INVOKED" -I > C:/PROGRA~1/R/R-28~1.1/inclu > de -i Testme_res.rc -o Testme_res.o > "g95" -shared -s -o Testme.dll Testme.def a01.CalculatorMod.o > a02.ANiceSubroutine.o > Testme_res.o -LC:/PROGRA~1/R/R-28~1.1/bin -lR > ld: Testme.def:6: syntax error > ld:Testme.def: file format not recognized; treating as linker script > ld:Testme.def:2: syntax error > make[3]: *** [Testme.dll] Error 1 > make[2]: *** [srcDynlib] Error 2 > make[1]: *** [all] Error 2 > make: *** [pkg-Testme] Error 2 > > > > Thanks for helping!!! :) > -- View this message in context: http://www.nabble.com/Step-by-step%3A-Making-an-R-package-with-Fortran-95-tp23669355p23773479.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.