Etienne Laliberté wrote:
Function/file names are hypothetical. Say I have written myfunction.R,
which calls myfunction.c via .C("myfunction", ...).

I've compiled successfully myfunction.c via R CMD SHLIB myfunction.c
in the terminal. Then, in the R console:

dyn.load("myfunction.so")
source("myfunction.R")
test <- myfunction() # works fine

So everything is in order, myfunction works perfectly.

Now I want to include myfunction() into a package called mypackage.
Here's what I did:

1) I've added PACKAGE = "mypackage" in the .C() line in myfunction.R.
2) I put myfunction.R into the R folder of mypackage
3) I put myfunction.c into the src folder of mypackage
4) I created myfunction.Rd into the man folder

I then build the package via R CMD build mypackage. All good. However,
when I run R CMD check mypackage, I get the following error (note that
I translated from french, might be a bit different in english):

Error in .C("myfunction", ...): C symbol name "myfunction" cannot be
found in the DLL for package "mypackage"

I would appreciate some help here. Please do not refer my to "Writing
R extensions" - if the answer's in there, I don't understand it.

What do you get from R CMD INSTALL mypackage?
Duncan Murdoch
Many thanks.

--
Etienne Laliberté
================================
Rural Ecology Research Group
School of Forestry
University of Canterbury
Private Bag 4800
Christchurch 8140, New Zealand
Phone: +64 3 366 7001 ext. 8365
Fax: +64 3 364 2124
www.elaliberte.info

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to