C++ Logo

sg15

Advanced search

Re: [Tooling] [isocpp-modules] Dependency format with module details implementation

From: Ben Boeckel <ben.boeckel_at_[hidden]>
Date: Thu, 11 Apr 2019 08:35:31 -0400
On Thu, Apr 11, 2019 at 12:45:36 +0200, Boris Kolpackov wrote:
> "Module interface (translation) unit" normally refers to a C++
> source file that defines the module's interface (i.e., it contains
> 'export module M;'). Are you saying that someone/something should
> be translating headers to equivalent "real" module interfaces? If
> so, that's an interesting idea, though I can also see an immediate
> problem: macros.

Not headers. Headers can be installed as-is. MIU files are more relevant
to "real" modules, particularly those with partitions.

> And if MIU is something else, can you elaborate on what it could
> contain?

Imagine a module with an exported partitions:

withparts.mpp:

    export module withparts;
    export import :partition;

    export int func() {
        return frompartition();
    }

partition.mpp:

    export module withparts:partition;

    export int frompartition() {
        return 0;
    }

When an external consumer wants to use the `withparts` module, what
rules should a build system create? The hypothetical MIU I'm thinking of
would be a distillation of the actual interface of the module including
partitions. A simple encoding would be something like the
pragma-delimited idea relevant to distributed compilation. The easy
solution is that you install your partition files too and they get added
to the "please compile these BMIs" set generated by the build system.

--Ben

Received on 2019-04-11 14:35:34