[Rd] BOOST libraries

Dirk Eddelbuettel edd at debian.org
Thu Apr 21 14:44:12 CEST 2011


(Redirected from r-packages, which is supposed to be an annoucements-only
list, to r-devel which is for R development questions.)

On 21 April 2011 at 08:10, Jay Emerson wrote:
| We have used the BOOST interprocess libraries in package bigmemory
| (and synchronicity, and ...) for about 3 years now.  There is also a

RQuantLib switched to using Boost when QuantLib did in June 2004, or almost
seven years ago.

| plan (more than tentative, but yet to actually happen) to provide a
| package on CRAN that will provide these for more efficient use (having
| multiple copies floating around across separate packages seems silly).
| 
| If you are interested in this, please feel free to email me or Dirk
| (and if you are not aware of Rcpp et. al. you should have a look
| there, too).

Cedric is a list member of rcpp-devel.
 
| >I would like to know whether anyone had experience using the C++ Boost
| >library within an R package, and how portable was the resulting package.

Packages are perfectly portable as that is a main goal of Boost.  So in that
sense the question is misdirected; few things are as 'portable' as Boost.

The issue is more about how to ensure _binary libraries_ are found if needed
for linking.  Boost itself is a (vast) collection of libraries (in the
abstract sense of 'packages'), and only a few employ (binary) libraries. Many
can be used in a pure template sense so that only headers are needed at
compile time. 

That is what Jay refers to above:  we are contemplating creating a common
boost headers package to be used by the half dozen packages shipping their
own copies.

| >I am especially thinking of possible compiling problems on Windows and
| >Apple systems.
| 
| >If anyone had any tips on how to render an R package using Boost
| >portable, that would be very much appreciated.

Back to the issue of finding Boost libraries: you can study existing
packages.  RQuantLib for example needs to use a configure snippet and a
special case on Windows.

But in case you just want to use templates, look at RcppBDT --- an example
package using Rcpp and its 'Rcpp modules' feature to easily access Boost
Date_Time.  It by choise does not use Date Time string parsing and formatting
and hence uses only templated headers---and as such is easily buildable on
Windows, OS X, ... as the CRAN page http://cran.r-project.org/package=RcppBDT
and its links show.

Hope this helps, Dirk

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



More information about the R-devel mailing list