[R] dyn.load

Mestivier Denis mestiv at bach.urbb.jussieu.fr
Tue Sep 14 18:43:11 CEST 1999


Hello,

I have a probleme with the dynamic loading. I make
two librairies "myfct.so" and "otherfct.so", where
"myfct.so" is calling functions of "otherfct.so",
and I want dyn.load() each of it,  without generating
a unique librarie. For exemple :

myfct.c :

void myfct(double *x, double *y)
{
 otherfct(x);
 *y=(*x)+1.0;
}

myoth.c :

void otherfct( double *x )
{
 *x=99.;
}

I create the two libraries as following :

~/R/testR$ R SHLIB myfct.c
gcc -g -O2 -fpic -I/usr/local/lib/R/include -c myfct.c -o myfct.o
ld -shared -o myfct.so myfct.o
~/R/testR$ R SHLIB myother.c
gcc -g -O2 -fpic -I/usr/local/lib/R/include -c myother.c -o myother.o
ld -shared -o myother.so myother.o

Then, when I am running R :

> dyn.load("myother.so")
> dyn.load("myfct.so")
> x_5
> y_7
> is.loaded(symbol.C("myfct"))
[1] TRUE
> is.loaded(symbol.C("otherfct"))
[1] TRUE
> .C("myfct",x,y)
/usr/local/lib/R/bin/R.binary: error in loading shared libraries
/home/mestiv/R/testR/myfct.so: undefined symbol: otherfct

What is my error ?
Thank you for your help,
sincerely

Mestivier Denis


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