|
Boost : |
From: Benoit Sigoure (tsuna_at_[hidden])
Date: 2008-01-15 05:57:23
On Jan 14, 2008, at 5:35 PM, Gennadiy Rozental wrote:
> Benoit Sigoure <tsuna <at> lrde.epita.fr> writes:
>> interact directly with `main' require you to invoke a function
>> directly from within main. Qt is a great example, you must
>> instantiate a QApplication and give it argc and argv. It's a very
>> common idiom. Yet Boost.Test decided that it was a good idea to
>> embed a `main' in a library (!). What if I want to link with two
>> libraries that decided that it was their own right to define `main'?
>> Come on, this is almost ridiculous and it seems that Gennadiy is not
>> willing to make any effort to understand the problem.
>
> I understand perfectly your problem. It seems you are not willing
> to listen to
> the solution I present. You need to understand I am long time in this
> buseness. I heard and thought of most possible issues with desing
> of the
> library. This one is pretty old. I believe that though solution I
> came up with
> may not be ideal for all involved, is the best under circomstances.
>
> 1. Embedding main into libtary has it's perks. Would you need to
> implement the
> same main() routine 10 times a day for a year, I can imagine you
> would also
> look for some way to avoid it. Avoiding to explain test runner API
> helps as
> well. It shortens learning curve for new users.
>
> 2. My primary limitation is to be portable.
>
> 3. Starting 1.34 there is a valid simple solution to the situation
> above: use
> shared library and you are good.
Look, you seem to believe that static and dynamic linking ought to be
totally different. That's a point on which we disagree. In modern
build systems, the user must be able to switch from one to the other
transparently. The build system takes care of adjusting the -lflags
or whatever. Your library requires extra special steps to make this
work, it's just annoying. I still think that embedding `main' in a
library is wrong, and should I be in your situation of `same main()
routine for 10 times a day' I'd make my `main' a one liner the way we
delegate it to a QApplication for instance.
Your method that works for 1.34 is not good for me, I provide a
*generic* build system tool which ought to work no matter which
version of Boost you use, no matter which compiler you use, no matter
whether you want to link dynamically or statically against the library.
I know you surely have good reasons for having done so, nevertheless
I still think this design goes against "standard" expectations. And
once again, if everyone was to reason like you and said "OK let's
factor `main' in a library" we'd end up with a big mess when trying
to link with 2+ libraries that define their own `main'...
-- Benoit Sigoure aka Tsuna EPITA Research and Development Laboratory
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk