[R] dyn.load error:

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Jun 19 07:51:56 CEST 2000

On Sun, 18 Jun 2000, reza shahidzadeh mahani wrote:

> Hi,
> I have some S functions plus Fortran routines that I want to use in R.
> They work in S, but when I try to use "dyn.load" to link fortran codes in 
> R , I get the following error. 
> thanks, reza
> (I am using R-1.0.1 on windows NT, The name of fortran file (compiled
> Ratfor) is deldirld.o and it's in the D:\Reza\476\tv.gonsrc.R\ directory)
> >dyn.load("deldirld.o")
> Error in dyn.load(x, as.logical(local), as.logical(now)) : 
>         unable to load shared library
> "D:\Reza\476\tv.gonsrc.R\deldirld.o":
>   LoadLibrary failure

Oh dear!  How did you get "deldirld.o" and where did you get the idea you
can dyn.load .o files on R for Windows?  (You can't do that on S-PLUS for
Windows either, so I have no idea how they `work in S'.)  If you look at
help(dyn.load) in R it says


 libname: a character string giving the pathname to a DLL.

Normally if you try something like this on NT you get a dialog box
giving further information, and rw1010 is intended to get the maximal
information out of Windows.

What you need for dyn.load is a DLL, specifically a 32-bit relocatable
DLL with all dependent DLLs in the load path (the directory from which the
DLL is loaded plus the PATH setting).  So you need to go back to your
compiler manuals and work out to make such a DLL.   If you are using 
the mingw32 version of g77 as recommended for building packages, the
simplest way is to set up a minimal package sources  and run

make pkg-mypkg

Since the availability of tools has changed since rw1001, we suggest you
get rw1010 and work with that.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list