Auto_link and BOOST_DYN_LINK

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. But given that the latter is considered allowable and the former not, I would suggest, along with my beginning suggestion, that BOOST_DYN_LINK be removed and that BOOST_STATIC_LINK be added to coerce the creation of a static library when linking to the DLL version of the RTL.

"Edward Diener" <eddielee@tropicsoft.com> 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

"David Abrahams" <dave@boost-consulting.com> wrote in message news:u1xmzbuta.fsf@boost-consulting.com...
"Edward Diener" <eddielee@tropicsoft.com> 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.
Appreciated, and makes sense. Thanks !

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. But given that the latter is considered allowable and the former not, I would suggest, along with my beginning suggestion, that BOOST_DYN_LINK be removed and that BOOST_STATIC_LINK be added to coerce the creation of a static library when linking to the DLL version of the RTL.
That's the way the regex used to work, I changed that for regex because folks were complaining that they wanted static linking as the default (smaller code size, no redistributables etc), the auto-link code then followed regexes lead... John.

"John Maddock" <john@johnmaddock.co.uk> wrote in message news:036d01c41d67$396f77e0$888d0252@fuji...
Now I know that auto-link specifies it is an #error if one tries to
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
create 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. But given that the latter is considered allowable and the former not, I would suggest, along with my beginning suggestion, that BOOST_DYN_LINK be removed and that BOOST_STATIC_LINK be added to coerce the creation of a static library when linking to the DLL version of the RTL.
That's the way the regex used to work, I changed that for regex because folks were complaining that they wanted static linking as the default (smaller code size, no redistributables etc), the auto-link code then followed regexes lead...
The static linking you describe, with no redistributables, means that one links with the static version of the RTL, else one must redistribute the dynamic RTL. I have no problem with that as the default when the dynamic RTL is turned off, as it makes sense to create all static libraries in that case. But if the dynamic RTL is turned on, this usually means to me that one is producing a dynamic link library of one's own, not a static library. OK, I know you know the argument. I just hope others are not as surprised as me when their efforts to link with the dynamic RTL produces a static Boost library unless BOOST_DYN_LINK is defined.
participants (3)
-
David Abrahams
-
Edward Diener
-
John Maddock