[Rcpp-devel] Named vectors

Dirk Eddelbuettel edd at debian.org
Thu Sep 9 23:14:02 CEST 2010

On 9 September 2010 at 14:05, Andrew Redd wrote:
| Thank you all for the comments.  They are very helpful as I'm just
| trying to get on board with Rcpp.
| My next problem with this is compiling and linking to the library in
| the package pomp.  I'll include the whole file here and hope that it
| does not offend anyone for being too big.

That's quite ok. There is a mailman limit on the size of posts, I think the
default value was a few dozen kB.

I think you are having two issues here, and I would personally try to
disentangle them:

  a) how to glue some of your code to R and pass parameters back and forth;
     we seem to have progress there

  b) how to reuse CRAN package pomp _directly_ in C++ code

I know nothing about pomp, and I have never attempted to link to the shared
libraries of a package before.  For starters, on Linux [Windows] these are
named 'foo.so' [foo.dll] and not 'libfoo.so' [libfoo.dll] so the linker
cannot find them.  So I am not convinced yet that b) is viable.  I would
recommend a C++ ten-liner with fixed params to see if you do this.  If so,
you can try to combine them.

If this fails you are back to old school use of either having to copy the
code from pomp into your package, and you probably want a package at point
rather than the quick-and-easy experimentation of inline (which is not meant
for multi-file projects).

One possible alternative is to redo what Davor showed for accessing loess's
internal code; the list archives for that.  That may work for you and you get
R to load pomp for your and then Rcpp to locate the function pointer. Dunno.

Good luck, Dirk

Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

More information about the Rcpp-devel mailing list