Boost logo

Boost :

Subject: Re: [boost] [netlib] Update: 0.9 will not be header-only
From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2010-12-05 23:22:26

On Sat, Dec 4, 2010 at 11:42 PM, Jeff Garland
<jeff_at_[hidden]> wrote:
> Dean Michael Berris wrote:
>> Hi Everyone,
>> To those who are following the development of cpp-netlib (which shall
>> be submitted for review /soon/ as Boost.Netlib), the current state of
>> 0.9-devel and thus what's going to come out officially as 0.9 in a
>> couple of weeks, will not be header-only. Aside from the obvious
>> reason that the compile-times are starting to become unbearable (>10
>> minutes to build the whole test suite!!) and after noticing that the
>> intended simplicity of the API with tag-metafunction dispatch is
>> limiting the expressiveness of the HTTP client types, the 0.9 release
>> will be the first release that will require an externally linked-in
>> static library.
> Just happened to catch this. As a fan for all inline code and having made my
> own mistake not being aggressive enough with date-time, I say why not make
> it a configurable option?  That way the client code can decide depending on
> their project structure. Even though I'm well versed in building boost libs
> I still love it when I don't have to be bothered. Inevitably, I'm working on
> some project and then I have to shift contexts, get bjam on the machine,
> include the new lib, etc when I already had that setup for the custom code
> I'm working. And besides, it's possible that some of us are using external
> tricks like pre-compiled headers that will reduce compile times.

Making it a compile time option would be a good choice. I thought
about it through the weekend and how I would like to go about doing it
and I think I might come with a good enough solution soon.

I tried out the precompiled headers with GCC, and unfortunately the
resulting precompiled headers are absolutely huge -- for including the
HTTP client and all required facilities that come with it, it amounts
to 248MB while the server implementation takes around 256MB. Just
reading those into memory is a problem enough for the compiler.

I haven't been able to see how big the precompiled headers turn out in
MSVC, and it might be something worth looking into. However, that only
solves part of the problem because since everything in the header-only
version of cpp-netlib is a template (function or type), that still
means that the compiler has to go through all the instantiations to
come out with the proper IR/binary.

> So, you might have something like this
> #include <boost/netlib_inline.h>
> versus
> #include <boost/netlib.h>
> to control the option. Or, of course, you could go with compiler
> macros/settings. Bottom line is that you can setup your test suite to use
> the library so that compile times are fast while still allowing all-inline
> for the rest of us.

Thanks for the suggestion, the only issue with that is the potential
maintenance problem that would pose for us working on the library and
supporting users that might use the inlined version and users using
the non-inlined version. At the end of the day though having a choice
is better than not having a choice at all. :)

I'll spend time today to get back into making the changes necessary to
make the library non-header only for those who want it non-header-only
while allowing an option for making it header-only. I'll seek
inspiration from other projects that have that option as well and I'll
see how far that goes for me. :D

Have a great day and thanks for the suggestions. :)

Dean Michael Berris

Boost list run by bdawes at, gregod at, cpdaniel at, john at