Date: Wed, 14 Feb 2024 17:41:29 +0200
Jan Kokemüller via SG15 <sg15_at_[hidden]> writes:
> let's say I'm packaging a modularized C++ library "foo" that consists of a
> module implementation unit "foo.cpp" and an importable module unit "foo.cppm".
> Where should the "library interface object files" live? In the "libfoo.{a,so}"
> I ship, or can I punt this task to the consumer, who will compile the
> importable module unit "foo.cppm" anyway (to get the BMI's)?
>
> I stumbled across this issue as I was trying to consume the experimental libc++
> "std" module. libc++ chose the second approach, i.e. the module initializer
> symbols are not packaged up in any library artifact provided by libc++.
FWIW, in build2 if the library is "binful" (has a .a/.so/.etc binary),
then the object file that is produced when compiling the module interface
always lives in the library binary.
But a user can force a library that only contains module interfaces
(which is analogous to header-only libraries) to be binless, in which
case the object file is produces and linked on the consumer side along
with the BMI. This is how we handle libc++ modules currently.
> let's say I'm packaging a modularized C++ library "foo" that consists of a
> module implementation unit "foo.cpp" and an importable module unit "foo.cppm".
> Where should the "library interface object files" live? In the "libfoo.{a,so}"
> I ship, or can I punt this task to the consumer, who will compile the
> importable module unit "foo.cppm" anyway (to get the BMI's)?
>
> I stumbled across this issue as I was trying to consume the experimental libc++
> "std" module. libc++ chose the second approach, i.e. the module initializer
> symbols are not packaged up in any library artifact provided by libc++.
FWIW, in build2 if the library is "binful" (has a .a/.so/.etc binary),
then the object file that is produced when compiling the module interface
always lives in the library binary.
But a user can force a library that only contains module interfaces
(which is analogous to header-only libraries) to be binless, in which
case the object file is produces and linked on the consumer side along
with the BMI. This is how we handle libc++ modules currently.
Received on 2024-02-14 15:41:34