Boost logo

Boost :

Subject: [boost] [detail] Compilation broken in develop and some questionable ideas
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2015-10-23 13:35:08


Hi,

The commit
https://github.com/boostorg/detail/commit/9fcf2ae390c7c21a9b42fd40dd5c0eec11c9d49f
breaks the compilation of Boost.Filesystem:

D:\t08\run\boost_root\boost/detail/utf8_codecvt_facet.hpp(126): error
C2487: 'do_in': member of dll interface class may not be declared with dll
interface
D:\t08\run\boost_root\boost/detail/utf8_codecvt_facet.hpp(136): error
C2487: 'do_out': member of dll interface class may not be declared with dll
interface
D:\t08\run\boost_root\boost/detail/utf8_codecvt_facet.hpp(152): error
C2487: 'get_octet_count': member of dll interface class may not be declared
with dll interface
D:\t08\run\boost_root\boost/detail/utf8_codecvt_facet.hpp(156): error
C2487: 'get_cont_octet_out_count': member of dll interface class may not be
declared with dll interface
D:\t08\run\boost_root\boost/detail/utf8_codecvt_facet.hpp(189): error
C2487: 'do_length': member of dll interface class may not be declared with
dll interface

According to MSDN only the whole class or class separate members could be
decorated with BOOST_UTF8_DECL, not both (
https://msdn.microsoft.com/en-us/library/t72ahzw1.aspx)

Now the questionable part...

We could theoreticaly avoid duplication of `utf8_codecvt_facet` code in
libraries and even avoid code breakage if we:
* move `struct utf8_codecvt_facet` to namespace
`boost::detail::utf8_codecvt_facet_namespace`
* mark all it's functions as inline, even the virtual ones => `inline` will
implicitly mark the stuff in `struct utf8_codecvt_facet` as weak symbols,
so that multiple occurences of it will be reduced to one by linker
* add the using declaration `BOOST_UTF8_BEGIN_NAMESPACE using
boost::detail::utf8_codecvt_facet_namespace::utf8_codecvt_facet;
BOOST_UTF8_END_NAMESPACE` => using declaration will help the existing code
to find class in `BOOST_UTF8_BEGIN_NAMESPACE` defined namespaces.

Questionable part number two...

Is it time to move Boost.Detail module into
Boost.Core/Boost.Algorithm/Boost.MPL? Main points are:
* Boost.Detail is really old and many people who maintained it are
inactive. Moving it into rapidly developing modules will improve it's
support (maybe even docs will appear! or tests!)
* Nobody knows what does `Deatil` mean in that particular case. `detail::`
namespace is a namespace that user must not use. However there's some cool
stuff in Detail module that must be available to users, so the name Detail
is obfuscating here.

-- 
Best regards,
Antony Polukhin

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