[Rcpp-devel] Building/linking trouble with cxxfunction()

Dirk Eddelbuettel edd at debian.org
Wed Feb 16 19:02:39 CET 2011

Hi Ken,

Thanks for your persistence with this!

On 16 February 2011 at 11:47, Ken.Williams at thomsonreuters.com wrote:
| Hi, I'm having some trouble wrapping a relatively simple C function using
| Rcpp and inline and friends.  This is my first time trying to use these
| tools, so I'm sure I'm doing something wrong  my immediate problem is
| that I can't seem to figure out how to link against a library when
| prototyping with cxxfunction().  My problem is explained here:
|   http://stackoverflow.com/questions/5009026/extract-long-from-r-object
| Anyone have any advice?  I'm on OS X Snow Leopard.

I saw your post there.  And I greatly appreciate that you now posted here.
| As an aside, have you considered moving this list to some open forum
| that's 1) searchable 

It is. The list archive has some Google juice. If you type a specific
question, you sometimes gets the list. That is a Good Thing.

| and 2) wouldn't require specific registration before
| posting?  

Gmame.org indexes it. I happily use Gmane to post (occassionally) post to
some lists I no longer am subscribed to, or never was, but still want to
interact with on occassionan; ess-help is a good example.  So your points 1)
and 2) are taken care of as far as I am concerned.

[ Lastly, remember that Romain and I do this as volunteers. I don't think too
many people would want us to focus on running a webboard rather than looking
after the code. That said, if you want to start and run a Rcpp discussion
board, go for it. ]

| StackOverflow would get my vote, since it focuses not just on
| answering questions but creating resources for those who come along
| afterwards.

There is nothing wrong with stackoverflow per se; I obviously have answered a
number of questions there.  But sometimes it cuts the audience too thinly. We
may have had a dozen Rcpp questions there, and most were of a rather
introductory nature.  Tricky stuff still needs to come here to also get in
front of Romain, Doug, Davor, Christian, ...

Now: your question.  We obviously cannot replicate this as we do not have the
library in question. I do assure you that everything I ever need to set in a
src/Makevars and/or a Makefile, I was also able to set in cxxfunction() for

But if it doesn't work with cxxfunction, I would humbly suggest you try the
manual route of a makefile (or even shell script) until you have PKG_CXXFLAGS
and PKG_LIBS set.  Once you know which values you need, you can then figure
out where to set them.  When I started with what is now RcppBDT (Rcpp to bind
Boost Date_Time), I started with headers and library. I later simplified /
reduced it to headers only so that was easier.  But we did the same things
when we started with RcppGSL etc pp. We even started that way with
RcppArmadillo til Doug convinced us to go Armadillo headers-only as it is
after all a template library with just a minimum of code in a lib, and that
functionality we we get mostly from R.

So in case you get really stuck, I will try to drum up a mock-up example
against an external library. Ok?

| [note, this is my second attempt sending this message, I think my first
| one was denied since I wasn't subscribed to the list (though I didn't get
| a notice to that effect).  Now I am.]

Yes. I look after half a dozen or so R related lists and I do not babysit. If
your post is important, I expect you to pay attention and catch a bounce.

Cheers, Dirk

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

More information about the Rcpp-devel mailing list