Building from a source-code library under Windows ================================================= First collect the tools that you need. We recommend that you use the mingw32 port of gcc-2.95 by Mumit Khan from ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32. You will also need suitable versions of make, sh, rm, sed, awk, mkdir, echo, cp and cat; we have packaged a set at bin/windows/windows-NT/etc/tools.zip extracted from the cygwin distribution (http://sourceware.cygnus.com/cygwin and several mirrors). To avoid past problems on some versions of Windows95, we use the cygwin ld contained in that set, which must be before the mingw32 one in your path. (We have no way of knowing if this is still necessary.) It is also possible to use earlier mingw32 compilers or cygwin-b20.1 with the --no-cygwin flag, but we suggest you do so only if you have a working setup from building earlier versions of R. We have also successfully used the variant of mingw32 that uses the MSVCRT run-time system (under gcc-2.95 but not earlier versions), and in the case of the mclust library found this more successful that the standard version. perl5, available via http://www.perl.com/CPAN/ports. groff, available at http://www.itribe.net/virtunix/groff-1.10nt.zip. All of these need to be installed and in your path, and the appropriate environment variables set. Edit MkRules to set target and the appropriate paths as needed. Then cd RHOME\src\gnuwin32 and run make libR.a which may take several minutes. (We have seen times from 30 secs to 20 minutes depending on processor speed, RAM, disk speed and compiler. Using a network file system is likely to take longer.) This only needs to be done once for each R release. For each package you want to install, unpack it to a directory, say mypkg, in RHOME\src\library, and run cd RHOME\src\gnuwin32 make pkg-mypkg The Makefiles can be customized: in particular the name of the DLL can be set (see the line integrate-DLLNM=adapt) and the compile flags can be set (see the examples in MakeDll). Using zipped help files ======================= You will need zip installed, of course. Just run make ziponly-mypkg after building mypkg. Target `ziphelp-mypkg' will make the zip files but not remove the separate files: this can be used for testing. Checking packages ================= The equivalent of `R CMD check mypkg' on Unix is make pkgcheck-mypkg This runs all the examples in the help files. Debugging ========= See the RW-FAQ. Using Visual C++ ================ You may if you prefer use Visual C++ to make the DLLs (unless they use Fortran source!). First build the import library R.lib by lib /def:R.exp /out:Rdll.lib Then you can compile the objects and build the DLL by cl /MT /Ox /D "WIN32" /c *.c link /dll /out:mypkg.dll *.obj Rdll.lib (at least under VC++ 4.2). If the C sources use R header files you will need to arrange for these to be searched, perhaps by /I ..\..\..\include If you build a debug version of the DLL in the development environment, you can debug the DLL code there just by setting the executable to be debugged to the full path to the R front-end.