C++ Logo


Advanced search

Re: [Tooling] [Ext] Modules and tooling: Resolving module import declarations

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Sun, 2 Sep 2018 17:59:35 +0000
> On Sep 2, 2018, at 8:16 AM, Tom Honermann <tom_at_[hidden]> wrote:
>> On 09/02/2018 10:01 AM, Nathan Sidwell wrote:
>>> On 09/02/2018 12:07 AM, Tom Honermann wrote:
>>> Gcc
>>> $ gcc -Ifoo/include t.cpp -lfoo -o t
>>> $ gcc -fmodules-ts -c Ifoo/include foo.cpp # generates foo.nms (and unused foo.o)
>> [missed '-' on the I option there, but that's obvious]
> Oops.
>> foo.o is not unused in general, it contains things like the definitions of exported or module-linkage non-inline functions & variables.
> Indeed. In the example, it is unused because it was presumably compiled previously and linked into the 'foo' library.
> The example is meant to reflect the scenario where a project (t.cpp) uses a packaged component (foo). Assuming that module artifact formats remain non-portable across compilers and non-stable across compiler releases, it doesn't make sense for a package manager to install module artifacts. Consumers of the component therefore need to be able to generate the module artifact, but need not generate and use the corresponding object file directly if it is already available in a library to be linked in. This demonstrates the utility in supporting a compiler invocation interface that generates only the module artifact (which I believe only Clang supports today; I missed adding "and unused foo.obj" for the Microsoft example).

MSVC supports that capability too with /module:ifcOnly.

>> IIUC clang treats the module BMI as an additional stage of compilation:
>> x.cpp->x.pcm->x.o
>> which must be compiled down to an object for correctness.
> That matches my understanding.
> Tom.
> _______________________________________________
> Ext mailing list
> Ext_at_[hidden]
> Subscription: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.isocpp.org%2Fmailman%2Flistinfo.cgi%2Fext&amp;data=02%7C01%7Cgdr%40microsoft.com%7C15cd7e24dea647640c3d08d610e70fbd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636714981932258556&amp;sdata=T41j6llX6M9WqAVgVfUZnNAwwRqrXXJBSg%2FESVwxea8%3D&amp;reserved=0
> Link to this post: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.isocpp.org%2Fext%2F2018%2F09%2F5751.php&amp;data=02%7C01%7Cgdr%40microsoft.com%7C15cd7e24dea647640c3d08d610e70fbd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636714981932258556&amp;sdata=XJ5twipDEjgLQ9KJE%2Bn%2BZ6PWTs2W1SxrOWqkzNZhIWc%3D&amp;reserved=0

Received on 2018-09-02 19:59:38