Re: [Rd] Problem with dyn.load...or else...

From: Marie-Hélène Ouellette <marie-helene.ouellette_at_umontreal.ca>
Date: Thu 07 Jul 2005 - 14:16:15 GMT

At 19:46 2005-07-06, you wrote:
>Marie-Hélène Ouellette wrote:
>>Hi everybody,
>>I'm working on Mac OS X and R-2.1.0 (by the way, sorry for the multiple
>>emails last time, had a technical problem, and thanks for the
>>constructive comments.)
>>I have a .R function which calls a .C function. The R function's name is
>>K_MEANSR.R and the other is K_MEANSC.C.
>>I compile it with 'R CMD SHLIB K_MEANSC.C' in the terminal. I get both
>>.so and .o files.
>>I use the function
>> > dyn.load ('K_MEANSC.so')
>>with no error. We can, I believe, see here that it is loaded:
>>
>> > getLoadedDLLs()
>>
>>Filename
>>base base
>>grDevices
>>/Library/Frameworks/R.framework/Resources/library/grDevices/libs/grDevices.so
>>stats /Library/Frameworks/R.framework/Resources/library/stats/libs/stats.so
>>methods
>>/Library/Frameworks/R.framework/Resources/library/methods/libs/methods.so
>>K_MEANSC
>>/Users/admin/Desktop/Marie/Marie_labo_29_juin/K-means_versions/MAC/K_MEANSC.so
>>R_X11 /Library/Frameworks/R.framework/Resources/modules/R_X11.so
>> Dynamic.Lookup
>>base FALSE
>>grDevices FALSE
>>stats FALSE
>>methods FALSE
>>K_MEANSC TRUE
>>R_X11 TRUE
>>
>>I then source the R code:
>> > source(file.choose())
>>Construct a matrix that I will use for the analysis:
>> > tab<-c(1,1,3,4,6,6,3,5,7,67,5,6,65,3,5,1,5,42,3,567,6,4,7,7)
>> > tab<-matrix(tab,6,4)
>>And try to use the function:
>> > K_MEANSR(tab,centers=c(2,4))
>>[1] "AA"
>>[1] "AAA"
>>[1] "A"
>>[1] "B"
>>Error in .C("K_MEANSC", xrows = as.integer(xrows), xcols =
>>as.integer(xcols), :
>> "C" function name not in load table
>>Everything that is printed on the screen is correct, but why does it says
>>that 'K_MEANSC' function is not in load table??? It then just stops at
>>that stage of the .R function.
>
>What does your declaration of the function look like in the K_MEANSC.C
>file? R needs to know the name of the exported function, not the name of
>the .so file.
>
>Duncan Murdoch

It's in the form:

K_MEANSC<- function(arguments...)
{

}
So the name of my .C function is also K_MEANSC... Marie-Hélène



Marie-Hélène Ouellette
UNIVERSITE DE MONTRÉAL
Département de sciences biologiques
Tél. (514) 343-6111 poste 1233

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Jul 08 00:19:04 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:14 GMT