Hi,
I apologize for this often/old question. I found some hints but couldn't
solve the problem so far.
I have C functions (incl. the header files) as well as the R wrapper
functions which I want to use for faster calculations. These functions
are included in a R package.
The installation process seems to be ok (no errors). I also can load the
package without errors. But when I call the function I got the following
error
> wy.result <- wy.grps(data1=X1, grpdata=groups, nres=10000,
alpha1=0.05, alpha2=0.05)
Error in .C("wy_grps_R", as.double(X), as.integer(n1), as.integer(n2),
:
C function name not in load table
Execution halted
The parameter are
data1 - result of read.table()
grpdata - dito
nres - integer
alpha1 nad alpha1 - factors (float)
In the R function wy.grps(...) the C function is called by using the
statement
result <- .C("wy_grps_R",
as.double(X),
as.integer(n1),
as.integer(n2),
as.integer(p),
as.integer(unlist(grpidx)),
as.integer(grplen),
as.integer(grpnum),
as.character(WYFUN),
as.double(alpha2),
as.character(MINMAXFUN),
WYdist=double(nres),
as.integer(nres),
test.value=double(grpnum),
p.value=double(grpnum))
My .First.lib.R is as follows:
.First.lib <- function(libname, pkgname) {
library.dynam("izbi", package = pkgname, lib.loc = libname)
data(COLS, package=pkgname)
data(ROWS, package=pkgname)
if (exists(".Dyn.libs")) remove(".Dyn.libs")
if (interactive() && getenv("DISPLAY") != "")
x11()
}
I read something about R_CMethodDef in "Writing R Extensions" but
I'm
not really sure where I should write it, may in the .First.lib.R or in a
separate file?
Any other possible mistakes?
We are using R 1.9.0 on Fedora Linux.
Thanks a lot, Toralf
.C has a named argument 'PACKAGE', which you didn't set. I usually have such an error when I forget about the argument.> -----Original Message----- > From: r-devel-bounces@stat.math.ethz.ch > [mailto:r-devel-bounces@stat.math.ethz.ch] On Behalf Of Toralf Kirsten > Sent: Tuesday, June 22, 2004 9:53 AM > To: r-devel@stat.math.ethz.ch > Subject: [Rd] function not in load table > > Hi, > I apologize for this often/old question. I found some hints > but couldn't solve the problem so far. > > I have C functions (incl. the header files) as well as the R > wrapper functions which I want to use for faster > calculations. These functions are included in a R package. > The installation process seems to be ok (no errors). I also > can load the package without errors. But when I call the > function I got the following error > wy.result <- > wy.grps(data1=X1, grpdata=groups, nres=10000, alpha1=0.05, > alpha2=0.05) Error in .C("wy_grps_R", as.double(X), > as.integer(n1), as.integer(n2), : > C function name not in load table Execution halted > > The parameter are > data1 - result of read.table() > grpdata - dito > nres - integer > alpha1 nad alpha1 - factors (float) > > In the R function wy.grps(...) the C function is called by > using the statement > > result <- .C("wy_grps_R", > as.double(X), > as.integer(n1), > as.integer(n2), > as.integer(p), > as.integer(unlist(grpidx)), > as.integer(grplen), > as.integer(grpnum), > as.character(WYFUN), > as.double(alpha2), > as.character(MINMAXFUN), > WYdist=double(nres), > as.integer(nres), > test.value=double(grpnum), > p.value=double(grpnum)) > > > My .First.lib.R is as follows: > .First.lib <- function(libname, pkgname) { > library.dynam("izbi", package = pkgname, lib.loc = libname) > data(COLS, package=pkgname) > data(ROWS, package=pkgname) > if (exists(".Dyn.libs")) remove(".Dyn.libs") > if (interactive() && getenv("DISPLAY") != "") x11() } > > I read something about R_CMethodDef in "Writing R Extensions" > but I'm not really sure where I should write it, may in the > .First.lib.R or in a separate file? > Any other possible mistakes? > > We are using R 1.9.0 on Fedora Linux. > > Thanks a lot, Toralf > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > >
>>>>> "Toralf" == Toralf Kirsten <tkirsten@izbi.uni-leipzig.de> >>>>> on Tue, 22 Jun 2004 18:52:51 +0200 writes:Toralf> I apologize for this often/old question. I found Toralf> some hints but couldn't solve the problem so far. Toralf> I have C functions (incl. the header files) as well really C, not C++ ? [or did you compile by a C++ compiler instead of C ?] I ask because for C++ that's really a FAQ Toralf> as the R wrapper functions which I want to use for Toralf> faster calculations. These functions are included in Toralf> a R package. The installation process seems to be Toralf> ok (no errors). I also can load the package without Toralf> errors. But when I call the function I got the Toralf> following error Toralf> wy.result <- wy.grps(data1=X1, grpdata=groups, nres=10000, Toralf> alpha1=0.05, alpha2=0.05) Toralf> Error in .C("wy_grps_R", as.double(X), as.integer(n1), as.integer(n2), : Toralf> C function name not in load table Toralf> Execution halted this really means that there's no exported C function named 'wy_grps_R' from the dyn.loaded C code. Do nm -g izbi.so inside izbi/src/ in the shell to check. Toralf> The parameter are Toralf> data1 - result of read.table() Toralf> grpdata - dito Toralf> nres - integer Toralf> alpha1 nad alpha1 - factors (float) Toralf> In the R function wy.grps(...) the C function is called by using the Toralf> statement Toralf> result <- .C("wy_grps_R", Toralf> as.double(X), Toralf> as.integer(n1), Toralf> as.integer(n2), Toralf> as.integer(p), Toralf> as.integer(unlist(grpidx)), Toralf> as.integer(grplen), Toralf> as.integer(grpnum), Toralf> as.character(WYFUN), Toralf> as.double(alpha2), Toralf> as.character(MINMAXFUN), Toralf> WYdist=double(nres), Toralf> as.integer(nres), Toralf> test.value=double(grpnum), Toralf> p.value=double(grpnum)) Vadim mentions that you should add PACKAGE= "<pkgname>" here which is true but not related to your problem. Toralf> My .First.lib.R is as follows: Toralf> .First.lib <- function(libname, pkgname) { Toralf> library.dynam("izbi", package = pkgname, lib.loc = libname) Toralf> data(COLS, package=pkgname) Toralf> data(ROWS, package=pkgname) Toralf> if (exists(".Dyn.libs")) remove(".Dyn.libs") not sure if the above is a good idea. What do you want it for? Toralf> if (interactive() && getenv("DISPLAY") != "") x11() Toralf> } Toralf> I read something about R_CMethodDef in "Writing R Toralf> Extensions" but I'm not really sure where I should Toralf> write it, may in the .First.lib.R or in a separate Toralf> file? That's something else nice -- but all happens on the C level. For an example of this see in the R sources R-1.9.1/src/library/stats/src/init.c Martin Maechler