[Rd] Problem with dyn.load...or else...
murdoch at stats.uwo.ca
Thu Jul 7 16:28:26 CEST 2005
On 7/7/2005 10:16 AM, Marie-Hélène Ouellette wrote:
> At 19:46 2005-07-06, you wrote:
>>Marie-Hélène Ouellette wrote:
>>>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
>>>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()
>>>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))
>>>Error in .C("K_MEANSC", xrows = as.integer(xrows), 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.
> It's in the form:
> K_MEANSC<- function(arguments...)
> So the name of my .C function is also K_MEANSC...
No, you misunderstood. That's R code; I was asking about the C language
code that you want .C("K_MEANSC", xrows = as.integer(xrows) ... to call.
More information about the R-devel