Boost logo

Boost Testing :

From: Juergen Hunold (hunold_at_[hidden])
Date: 2006-11-16 13:34:24


Hi Dave !

On Thursday 16 November 2006 18:41, David Abrahams wrote:
> Juergen Hunold <hunold_at_[hidden]> writes:
> >> I hope there's a compelling reason for statically linking.
> >
> > The only reason is to be consistant on all platforms. The use of
> > shared libraries with msvc requires special support. This support
> > is not available for serialisation, so we link static for _all_
> > platform now in order to get (nearly) the same errors on all
> > platforms.
>
> Why is that a desirable thing?

Because is took me several days to figure out why dynamic linking on
Unix (Linux in this case :-)) ) works and dynamic linking on Win32
would produce "unresolved symbol _main".

The documentation Gennadiy is currently working on would have helped a
lot, but it is a surprise (at least it was for me) that one thing that
is working on one platform suddenly breaks when using another platform
with the _same_ source code. And this was what happened to me :-((

This clearly violates the principle of "least surprise".

Well, the core issue is: How to deal with those platform dependencies ?

With msvc, main() can''t be part of the unit_test dll. On Unix it can.

Gennadiy has developed really cool macro automagic for the AUTO_TEST
framework which just works out of the box. Those libraries using it are
running dynamic linked tests on all platforms now.

Those libraries using the old (and soon to be deprecate old framework)
have to link to static libraries because they don't have a main in the
unit_test.dll. on Windows/msvc.
Those are running against the static linked test library on all
platforms.

So we have uniform behaviour on _all_ platforms and no surprises. (At
least after resolving the last issues with dll using msvc, of
course :-)). And the surprise that the disk space for running all 1200+
serialisation tests on linux went out of the roof for Martin Wille due
to static linking.

I've been digging through the bowels of the #ifdef cascades used to
implement the current behaviour and can't think of a general better
solution which would be releaseable soon.

The think needed to get serialisation to use dynamic linking again is to
provide a "main()" of its own when using <link>shared.

We should just agree to put just a "shared_test_main" into libs/test/src
and then reference it from all libraries which need it.

But this would be a Boost only special solution to make almost all
libraries using space (and link time) effective shared linking on all
platforms again.

Yours,

Jürgen

-- 
* Dipl.-Math. Jürgen Hunold  ! Ingenieurgesellschaft für 
* voice: ++49 511 262926 57  ! Verkehrs- und Eisenbahnwesen mbH  
* fax  : ++49 511 262926 99  ! Lister Straße 15
* juergen.hunold_at_[hidden]   ! www.ivembh.de

Boost-testing list run by mbergal at meta-comm.com