[R] Problem with dyn.load()

Francisco J Molina FJMolina at lbl.gov
Tue Apr 16 06:23:49 CEST 2002


I tried to dynamically load a c++ function. Everything seems to be OK
when dyn.load() is  executed but then I get this error


Error in .C("integral", sumInMean, sumInVar, boundError,
numberSampleClasses,  : 
        C/Fortran function name not in load table


The code of the function is something like this:

#include <cmath>

extern "C" {
#include "/usr/local/include/gsl/gsl_statistics_double.h"
#include "/usr/local/include/gsl/gsl_randist.h"
#include "/usr/local/include/gsl/gsl_roots.h"
#include "/usr/local/include/gsl/gsl_sf_erf.h"
#include "/usr/local/include/gsl/gsl_math.h"
#include "/usr/local/include/gsl/gsl_integration.h"

void integral( arguments ){
...
return;
}
}

I compile with:

g++ -c integral.C -fPIC -I/usr/local/include/gsl -o integral.o; R CMD
SHLIB integral.o

What could go wrong? The function modify its arguments ( the arguments
are  pointers )

I put my function with the C header directives in extern{}.

gsl is a library written in C, so I put the gsl's header directives also
inside extern{}.

I placed in my compiling directory a Makevars file with this content:

PKG_LIBS = -lm -lgsl -lgslcblas

and my R code looks like:

dyn.load('/usr/local/lib/libgslcblas.so',F,)
dyn.load('/usr/local/lib/libgsl.so',F,)
dyn.load('/home/f/p/integral.so')

Any hint?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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