[Rcpp-devel] [Rd] FW: Question on 5.6 Interfacing C++ code

Dirk Eddelbuettel edd at debian.org
Sat Apr 23 13:37:49 CEST 2011


Sean,

Please STOP CROSSPOSTING. Pick one of rcpp-devel or r-devel. I used the
former here but there is nothing really specific to Rcpp in your quests to
build a package.

On 23 April 2011 at 04:03, Sean Robert McGuffee wrote:
[...]
| NAMESPACE file. Was this obvious to everyone else from reading the manual?

Yes.

| If I want to name a package "MY_PACKAGE_NAME"
| then I have to do three things with this name to get Rcpp and/or my package
| calling c++ to install and run correctly. I'll call my package directory TOP
| 1) put the line "Package: MY_PACKAGE_NAME" inside of TOP/DESCRIPTION
| 2) put the line "useDynLib(MY_PACKAGE_NAME)" inside of TOP/NAMESPACE
| 3) make sure the final dynamic library is named TOP/src/MY_PACKAGE_NAME.so
| Do the experts agree that this is correct and necessary?

Yes.

Also note that package.skeleton() could have created all that for you, or in
the Rcpp context, Rcpp.package.skeleton().   See the Rcpp-package vignette.

| I happen to have named TOP to be MY_PACKAGE_NAME too, is that important too?

No.  

(It used to be, though, so it is often by convention. Does no harm.)

| I also happen to be naming my function MY_PACKAGE_NAME too, is that
| important? If I want to add more functions, I assume I can do that as long
| as I link them into the TOP/src/MY_PACKAGE_NAME.so file. Is that correct?

Yes.

If you let R do its way, then a package with 'Package: foo' will end up with
src/foo.so nomatter what the function names in src/*cpp are.


Hth, Dirk

-- 
Gauss has an Erdos number of -1.
   -- #63 at http://www.gaussfacts.com


More information about the Rcpp-devel mailing list