From =?iso-8859-1?Q?Marie-H=E9l=E8ne?=  Thu Jul  7 16:16:15 2005
From: =?iso-8859-1?Q?Marie-H=E9l=E8ne?= (=?iso-8859-1?Q?Marie-H=E9l=E8ne?=)
Date: Thu, 07 Jul 2005 10:16:15 -0400
Subject: [Rd] Problem with dyn.load...or else...
In-Reply-To: <42CC6D3F.3020608@stats.uwo.ca>
References: <6.2.1.2.1.20050706190146.0234a740@magellan.umontreal.ca>
	<42CC6D3F.3020608@stats.uwo.ca>
Message-ID: <6.2.1.2.1.20050707101340.02321418@magellan.umontreal.ca>

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



[Rd] Problem with dyn.load...or else...
=?iso-8859-1?Q?Marie-H=E9l=E8ne?=