[R] dynamic loading - w32

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jan 26 16:58:14 CET 1999


> From: "Edward Susko" <susko at mscs.dal.ca>
> To: <r-help at stat.math.ethz.ch>
> Subject: [R] dynamic loading - w32
> Date: Tue, 26 Jan 1999 11:22:26 -0400
> X-Priority: 3 (Normal)
> X-MSMail-Priority: Normal
> Importance: Normal
> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
> 
> Has something changed in dyn.load between rw0630 and rw0632

No.

> The compiler used to dynamically load a routine to compute the sum of
> a vector in the folllowing example is mingw32-egcs-1.1 (Win98):

You need to use the ld from the Cygwin set with mingw32-egcs-1.1.

> [C:/usr/home/slib/test] gcc -c test.c
> [C:/usr/home/slib/test] dllwrap -o test.dll --def test.def test.o -lm
> 
> Using rw0630:
> 
> > dyn.load("test.dll")
> > a <- c(1, 3.5, 5, 6)
> > f <- 0
> > n <- 4
> > .C("mysum", as.integer(n), as.double(a), as.double(f))[[3]]
> [1] 15.5
> 
> Using rw0632:
> > dyn.load("test.dll")
> Error in dyn.load(x) : unable to load shared library
> "C:\usr\home\slib\test\test.dll"

The symptom here is that whether this works or not is pretty random, as
the DLL contains a section that is not intialized but should be for use
on some Win9x systems.  The ld in the mingw32 distribution (even
-1.1.1) is faulty.  The use of the Cygwin ld solves this (it is on CRAN
in Guido's section).  I don't know what your dllwrap does precisely
(there are several versions about) so use the Makefiles in the
source/package build distributions.

This works for me every time, and I've changed nothing in my setup
since rw0630.

-- 
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