From maechler at stat.math.ethz.ch  Wed Jun 23 14:38:30 2004
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Wed Jun 23 14:38:32 2004
Subject: [Rd] function not in load table
In-Reply-To: <40D94F17.70303@izbi.uni-leipzig.de>
References: <40D863E3.1050209@izbi.uni-leipzig.de>
	<16601.14964.360131.27461@gargle.gargle.HOWL>
	<40D94F17.70303@izbi.uni-leipzig.de>
Message-ID: <16601.31174.615612.410723@gargle.gargle.HOWL>

>>>>> "Toralf" == Toralf Kirsten <tkirsten@izbi.uni-leipzig.de>
>>>>>     on Wed, 23 Jun 2004 11:36:23 +0200 writes:

    Toralf> Hi Martin, Vadim,
    Toralf> <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

    Toralf> It's really a C function.

ok

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

yes.


    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> What do you think what is not a good practice?

only the last line (before which I had added an empty line)
removing .Dyn.libs.


    Toralf> The COLS and ROWS are R objects which we use in R
    Toralf> programs to replace the 1 and 0 used as col and row
    Toralf> parameter.

(I don't understand but it's not relevant here anyway)

    Toralf> Do you think we should use the command
    Toralf> dyn.load("<compiled_code.so>")
    Toralf> for each C file instead of
    Toralf> library.dynam(...)?

No, no these were fine. Do not change them

    Toralf> I also tried to specify the package name in this manner
    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),
    Toralf> PACKAGE="izbi")

    Toralf> Unfortunately it didn't solve the problem.

yes, as I said in my e-mail.

I'm almost at the end of my hints here.
One thing -- you probably have already tried is to use
is.loaded()  
as in the following example

  > is.loaded(symbol.C("pam"))
  [1] FALSE
  > library(cluster)
  > is.loaded(symbol.C("pam"))
  [1] TRUE
  > 

but I presume you will just find that
    is.loaded(symbol.C("wy_grps_R"))
gives FALSE for you even after  
    library(izbi)

Is there nobody in Leipzig willing to delve into your package's
source?

Regards,
Martin


[Rd] function not in load table
Martin Maechler