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

Dirk Eddelbuettel edd at debian.org
Wed Feb 16 23:53:57 CET 2011

On 16 February 2011 at 16:20, Ken.Williams at thomsonreuters.com wrote:
| On 2/16/11 4:00 PM, "Dirk Eddelbuettel" <edd at debian.org> wrote:
| >Here is an updated version of the 'secondExample' from that aforementioned
| >example file in Rcpp.  It uses the plugin generator facility to override
| >LIBS which makes it work on my box.
| Aha, I hadn't suspected that plugins would be the secret to using
| libraries. 

No, as I tried to explain in great length. The minimal example should always

	$ export PKG_CXXFLAGS="...some header location..."
	$ export PKG_LIBS="...some libs..."
	$ R CMD SHLIB foo.cpp

and inline / cxxfunction can be of help if you know these values.

| Thanks for the pointer, I'll give this a shot in addition to
| the code that Doug posted.

I also had look at RcppGSL and why I needed to muck with the generator. My
installation must have had a test version.  Once I reinstalled RcppGSL from
either SVN or the released version, the normal behaviour worked ie

    funx <- cxxfunction(signature(par="numeric"), gslrng,
                        includes = "#include <gsl/gsl_rng.h>")

for the example posted earlier.  That is how it should work -- we employ
RcppGSL, we want an additional header which I list, and the rest 'just works'.

| Is the Rcpp:::Rcpp.plugin.maker() function documented anywhere?

Well theree is source, and there are package using it.  There was a prior
discussion on the list here in December.  But that is about it at this point.

Patches always welcome! Some user have in fact sent us documentation patches....

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

More information about the Rcpp-devel mailing list