From tkirsten at izbi.uni-leipzig.de  Wed Jun 23 11:36:23 2004
From: tkirsten at izbi.uni-leipzig.de (Toralf Kirsten)
Date: Wed Jun 23 11:39:36 2004
Subject: [Rd] function not in load table
In-Reply-To: <16601.14964.360131.27461@gargle.gargle.HOWL>
References: <40D863E3.1050209@izbi.uni-leipzig.de>
	<16601.14964.360131.27461@gargle.gargle.HOWL>
Message-ID: <40D94F17.70303@izbi.uni-leipzig.de>

Hi Martin, Vadim,

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

It's really a C function.

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


I checked the exported function as you mentioned above and I can see the 
function named 'wy_grps_R' in the list (as you can see below)
...
00004d80 T uvarWYdist
00004790 T wy_clust_R
000045a0 T wy_grps_R   <---
00004450 T wy_uvar_R
...
The T in the second column means it is available in the code segment, right.

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

What do you think what is not a good practice?
The COLS and ROWS are R objects which we use in R programs to replace 
the 1 and 0 used as col and row parameter.
Do you think we should use the command
dyn.load("<compiled_code.so>")
for each C file instead of
library.dynam(...)?

I also tried to specify the package name in this manner
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),
              PACKAGE="izbi")
Unfortunately it didn't solve the problem.

Many Thanks for your help,
Toralf


[Rd] function not in load table
Toralf Kirsten