Dear R users,
I would like to use several R functions from a C-code and I have read the "Introduction to the .C Interface to R". Unfortunately, my shared library with the C-code works only in cases where I use R-routines that are defined Rmath.h, eg.
double sum = dnorm(1.0/1, 0, 1, 0); }
Compiling and building shared library:
gcc -I/usr/lib64/R/include -fPIC -O2 -c test.o test.c gcc -shared -L/usr/local/lib -o test.so test.o -L/usr/lib64/R/lib -lR Calling R and loading test.so works fine:
>dyn.load("test.so")
>
Now, I would like to use other R functions e.g. the mean function from the base package:
double sum = mean(1.0);
}
Compiling and building shared library:
gcc -I/usr/lib64/R/include -fPIC -O2 -c test.o test.c gcc -shared -L/usr/local/lib -o test.so test.o -L/usr/lib64/R/lib -lR
Calling R and loading test.so results in an error:
> dyn.load("test.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library '/home/obc/test.so':
Any hint is welcome.
Olaf Schenk
This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:53 EST