From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2024-04-29 12:01:40


On 4/29/24 14:30, John Maddock via Boost wrote:
> On 29/04/2024 11:41, Peter Dimov via Boost wrote:
>> Alexander Grund wrote:
>>>>> One reason against autolink: It decides the use of static vs dynamic
>>>>> libraries depending on a preprocessor define, good luck getting that
>>>>> right in a portable way...
>>>> The preprocessor define is necessary for things to work, so autolink
>>>> is correct to decide based on it.
>>> I am aware of that, I consider that define basically part of the
>>> autolink feature.
>> No, it's not part of the autolink feature. It needs to be set properly
>> whether
>> or not autolink is used.
>
> Right, the whole __declspec(dllimport/dllexport) annotation needs to be
> set consistently across TU's, so there is always *some* macro or other
> which must be set consistently or "bad things may happen".  All we're
> really doing is giving the macro a consistent name.

I'll add that at least for Boost.Log defining (or not defining)
BOOST_LOG_DYN_LINK/BOOST_ALL_DYN_LINK also affects library namespace.
Users will simply fail to link if they didn't define the macro correctly
or inconsistently between TUs.