These are instructions for building an R-compatible library FOR windows AND ON a windows machine.

[Eva's note: I haven't yet been able to successfully cross-compile a Windows DLL on Mac OS X or Linux, but as soon as I figure it out, I will put instructions here.]

Instructions stolen directly from:

http://gsbwww.uchicago.edu/fac/peter.rossi/teaching/37904/Adding%20Functions%20Written%20in%20C%20to%20R.pdf

You will need three things:
1. A set of compatible tools which are various UNIX utilities ported to Windows
tools.zip in this directory
[ Original URL: http://www.murdoch-sutherland.com/Rtools/tools.zip, broken at time of writing ]

2. A version of PERL for Windows
http://www.activestate.com/Products/ActivePerl/Download.html.

3. The "minimal" version of GNU for windows (MinGW)
http://www.mingw.org/download.shtml
[ Original URL: http://prdownloads.sourceforge.net/mingw/MinGW-3.1.0-1.exe ]

Download the tools.zip file and unzip into c:\Rtools.

Allow the MinGW and PERL .exe files to install these sets of programs in their default places (c:\Perl and c:\MinGW).

You must modify the path under windows so that R CMD SHLIB can find everything that it needs. To modify the path, right click on the "my computerÓ icon on the desktop and select "properties.Ó Go to the "advanced tabÓ and click on environmental variables. Select the system variable path and make sure that it BEGINS with:

c:\rtools;c:\mingw\bin;c:\Perl\bin\;c:\PROGRA~1\R\rw2001\bin;

(assuming that you have R version 2.0.1 installed). To edit the path, selected "editÓ and use the arrow keys to advance to the beginning of the path and insert the above text.

Now you are ready to start writing code and creating DLLs.

[skipping example code available in PDF instructions]

To build a DLL, simply use the Windows command

RCMD SHLIB <list of files>

e.g. 
RCMD SHLIB *.cpp
