[Rcpp-devel] Regular Expressions

Gabor Grothendieck ggrothendieck at gmail.com
Tue Mar 5 13:25:25 CET 2013


On Mon, Mar 4, 2013 at 9:09 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 4 March 2013 at 20:18, Gabor Grothendieck wrote:
> | I had no luck with sourceCpp or inline on Windows but did manage to
> | use R CMD SHLIB to build a dll which loads into 32-bit R (it does not
> | currently load in 64-bit R - haven't yet figured out why) and seems to
> | run ok there.  To get it to work I did replace the first and last
> | statements in regexDemo with these two respectively so that all inputs
> | and outputs are SEXPs:
> |
> |     extern "C" SEXP regexDemo(SEXP ss) {
> |        std::vector<std::string> s = Rcpp::as<std::vector<std::string> >(ss);
> |
> |     return Rcpp::wrap(Rcpp::DataFrame::create(Rcpp::Named("input") = s,
> |                                    Rcpp::Named("valid") = valid,
> |                                    Rcpp::Named("machine") = machine,
> |                                    Rcpp::Named("human") = human));
> |
> | This isn't quite as nice as what you had but at least it runs.
>
> Thanks for reporting back, and glad you get something to work. Going back to
> the metal can help.
>
> I won't be of much help for the Windows aspect.  The basic things all work,
> and from the 100+ CRAN packages now using Rcpp, many do involve libraries. If
> you _really_ wanted to squash this you could try to rebuild libboost_regex.a
> during the package build process (of a to be built package) to ensure that
> the same g++ gets used. That should help with 32/64 bit too.  But that is
> surely overkill.

I did rebuild boost from source as part of this since I also figured
that might be a problem.  On Windows there is a tool that is used  in
rebuilding the source (presumably similar to configure on UNIX) and I
rebuilt that tool from source too.  I may play around with all this a
bit more but it does take half an hour to build boost from source.
Its possible that some of the things I tried prior to rebuilding from
source would have worked had that they been tried with the rebuilt
version of boost.

Is it intended that BH will include boost libraries like Boost.Regex
which is not a header-only library?  Alternately if R made its own
regular expression libraries available to C++ programs there could be
an advantage in terms of consistency with R of the regular expressions
accepted.

Regarding packages, can you suggest which one(s) to look at?


--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com


More information about the Rcpp-devel mailing list