Boost logo

Boost Users :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-04-13 12:53:48


Lynn Allan wrote:
> WinXp-SP2 vc7.1
>
> Would it be feasible/advantageous for xpressive to have an
> installation procedure a'la regex to build a whole series of .lib
> libraries?
>
> That seems to speed up builds quite a bit.

Everything is a template. What should be exported from the lib? It would
be impossible for static regexes. For dynamic regexes, it would be
possible to put sregex_compiler, cregex_compiler, and the wide char
variants into a separate lib, but you're the first to ask for it, and I
haven't felt the need. In fact, some prefer header only libs because
they're easier to work with. A significant fraction of the problems
reported with boost.regex have to do with problems linking to the
separate lib. I'm not sure I want to spend my time debugging other
people's build configurations. :-P

My suggestion would be to have one cpp file in your project that exports
the following function:

sregex sregex_compile(
     std::string const &pat
   , regex_constants::syntax_option_type flags)
{
     return sregex::compile(pat, flags);
}

In this file and this file only, you include xpressive_dynamic.hpp. (You
can export other functions for other basic_regex instantiations.) In
files where you use regexes, you can include basic_regex.hpp,
regex_algorithms.hpp, match_results.hpp, and sub_match.hpp. Wherever you
need static regexes, you should include xpressive_static.hpp. This
should give you all the benefit of separate compilation.

HTH,

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net