Boost logo

Boost :

From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2008-01-31 17:19:50


Hartmut Kaiser wrote:
> Stefan,
>
>>> I'm not sure where the -lpthread needs to be added (I added it
>> manually
>>> to the link command and it succeeded), or in fact, why wave links to
>>> boost_thread at all. It doesn't use threads underneath, or does it ?
>> It turns out the dependency on boost_thread is dragged in by
>> boost.spirit. (I modified the subject line to reflect this.)
>>
>> I'm not sure in what way boost_thread is used there, but I would hope
>> that the decision to use threads (and boost_thread) could be left to
>> the
>> library's user. Only pay for what you really use, or so the saying
>> goes...
>>
>> Is it possible to modify the config logic to have some users only use
>> the subset of boost.spirit that doesn't require boost_thread ?
>>
>> (I'm writing a preprocessor and I do not want to use threads, so why
>> would I have to link with boost_thread and pthread ?)
>
> Wave drags in threads only if it gets compiled in an environment requiring
> threads (BOOST_HAS_THREADS is defined). If you build Wave such that
> BOOST_HAS_THREADS is not defined, it won't depend on threads.

But having threads and using threads are not the same thing !
Also, I find this configuration-based approach a little too
coarse-grained. Ideally the question of whether or not to use threads
(or whatever it is boost.spirit uses that requires thread support) would
be configured using a template parameter (policy / traits), so the same
library could be used with and without threads without requiring a
separate build.

Of course, this is all wishfull thinking only, I don't know boost.spirit
and thus have no idea why you chose to design it the way you did.

Thanks,
                Stefan

-- 
       ...ich hab' noch einen Koffer in Berlin...

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk