Boost logo

Boost :

From: Ruben Perez (rubenperez038_at_[hidden])
Date: 2024-12-19 14:51:56


On Thu, 19 Dec 2024, 15:44 John Maddock, <jz.maddock_at_[hidden]> wrote:

>
> > If I understood the CMake developers and Chuanqi correctly (please let
> > me know if I didn't), you do install a library with the generated
> > object files, but you do not install the BMIs, as they're like
> > pre-compiled headers.
> >
> > Let me explain how I understood it with two concrete examples. Take
> > Boost.Url as an example of a compiled library, and Boost.Regex as an
> > example of a header-only library.
> >
> > 1. Boost.Url today installs:
> > * libboost_url.a, containing function definitions.
> > * Headers, containing declarations.
> > 2. Boost.Url in the module world would install:
> > * libboost_url.a, containing the same function definitions as above.
> > * A boost_url.cppm file, akin to what headers are today.
> > CMake would build a BMI from this file when a user needs to
> > import boost.url.
> > In practice, this cppm file will likely be implemented in terms of
> the
> > header files that we have today.
> > 3. Boost.Regex today installs:
> > * Headers, containing declarations and definitions.
> > 4. Boost.Regex in the module world would install:
> > * A libboost_regex.a object, containing module initializers [1].
> > For instance, if you have a singleton defining a Boost.System
> > error category,
> > initialization code for the singleton would be emitted here.
> > From the docs, it seems this object gets created even if no
> > initialization code is required.
> > * A boost_regex.cppm file, containing the bulk of the library, akin to
> > what we provide using headers today.
> >
> > My intention is doing some testing to see how much trouble would this
> > new libboost_regex.a library cause.
>
> I'm not quite convinced it's that simple, at it's most basic, consider
> an inline function that is part of the module interface, if I compile
> the module's object library for release, and then do a debug build of
> the bmi and my project what happens? Even if clang makes that example
> work out in msvc land where almost every option creates binary
> compatibility issues, I see users compiling the object library from
> source on a per-project basis.
>

I'd expect the inline function to be part of the BMI (which gets built by
the user), and not part of the object file, thus not creating trouble. Of
course, I could be wrong, so I'll try it.

Regards,
Ruben.


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