Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-04-07 11:45:53


"Edward Diener" <eddielee_at_[hidden]> writes:

> I know it is late to suggest a change but I think that the default when one
> links to the dynamic RTL should be that a dynamic link library is created,
> not a static library.
>
> My own experience is that creating a dynamic link library is the norm when
> linking to the dynamic RTL, creating a static library is the norm when
> linking to the static lib version of the RTL, and that following any other
> mixed setup seems to lead to problems at run-time, particularly when memory
> management is involved.
>
> Now I know that auto-link specifies it is an #error if one tries to
> create a dynamic link library, using BOOST_DYN_LINK, when one is
> using the static version of the RTL. I am wondering why this is any
> less of a problem than if one attempts to create a static library
> using the DLL version of the RTL. Despite the fact that I don't
> like either mixture, I would welcome an explanation of why one is
> allowable, and safe, and the other is not.

The RTL is responsible for OS resource allocation, and when two copies
are used together, as occurs when two DLLs are each using a static
RTL, resources must be deallocated in the same RTL where they were
allocated. There's no analagous problem when using a dynamic RTL with
static libraries. Although static user libraries may
allocate/deallocate resources of their own, linking two copies of the
same static user library together always fails.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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