[Rd] Fortran DLLs and R

jferrari at umces.edu jferrari at umces.edu
Wed Mar 24 18:29:56 CET 2010


Hi All,

I'm writing R code that would benefit from doing certain tasks using
compiled blocks of code, specifically Fortran subroutines of my own
(already written, debugged in both Fortran77 and Fortran90).

I am currently working on a Windows machine using Lahey and/or MinGW(g77)
compilers.

It is possible to dynamically load Fortran DLLs into R as evidenced from
the several documents I've found on-line giving details on how to do this
(specifically for Windows).  However, following the examples in these
documents... none of them successfully deliver a DLL that can be called
from R (and I'm talking for simple test Fortran subroutines that add 2+2).

Either the directions for creating the DLL (for a specific compiler) do
not work (no DLL created), or a DLL is created and exists but will not be
loaded/recognized by R (result of is.loaded = FALSE).

Can anyone give me a quick/dirty step by step on how to create a DLL
(using g77 compiler, specifically MinGW for Windows) so that it will work
in R, on a Windows machine (as well as any tips on anything that has to be
done to, or in, R to get it to work), or if there's a definitive easy to
read paper/book describing the process?

Any advice/input would be greatly appreciated.

Thank you!

Joe Ferrari


Joseph Ferrari
Faculty Research Assistant
UMCES Appalachian Laboratory
301 Braddock Road
Frostburg, MD 21532



More information about the R-devel mailing list