how to specify gcm.cache in g++ command line option?

g++ needs to have access to the compiled modules that are required by a module. Thus,. if we compile the first module that has no inter-module dependecies like this:

g++ -std=c++20 -fmodules-ts -c -x c++ file1.ixx

This produces a compiled module defined in file1.ixx called file1.o and also places in the folder gcm.cache as file1.gcm

This gcm file is needed by the other modules that are clients of this initial module but HOW do we specify how to link with gcm?

I tried:

g++ -std=c++20 -fmodules-ts gcm.cache\*.gcm -c -x c++ file2.ixx

but it does not compile - it behaves as if file1.ixx necer existed nor the gcm of file1.ixx ...

So I am not sure how to link the module definitions to the gcm.cache!!


gcm.cache sounds like something that is used internally. I would think that only file1.o is relevant.

Why do you think that you need that cache file?
the gcm.cache contains compiled information from the module that is required by the second source file because this second file imports the module defined in the first file. the first file is compiled and placed in the cache... what we are missing is the linking of the first withj the second file.
Of course gcm.cache is internal implementation but it looks very close to supporting modules! maybe in next release of g++ we will have this incomplete support better implemented
Registered users can post here. Sign in or register to post.