[R] dynamic loading - w32

Edward Susko susko at mscs.dal.ca
Tue Jan 26 16:22:26 CET 1999


Has something changed in dyn.load between rw0630 and rw0632

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


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

[C:/usr/home/slib/test] cat test.c
void mysum(long *n, double *x, double *f){

  int i;

  *f = 0.0;
  for(i = 0; i < *n; i++)
     *f += x[i];
}

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