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

Sean Robert McGuffee sean.mcguffee at gmail.com
Sun Apr 24 00:54:38 CEST 2011


Hi, sorry about the cross post thing--I just wanted to let both lists
know that my problem was solved since both list originally found out
about it.
With regard to the Rcpp.package.skeleton(), it worked really well for
me and easily to start a package.
What I couldn't figure out was how to add to a package once I already
started one.
Say for example, if I add a new class with source.cpp and header.h
file, what is the syntax to add them via Rcpp.package.skeleton()?
Thanks,
Sean

On Sat, Apr 23, 2011 at 7:37 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> 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