File: modhdr.yo

package info (click to toggle)
c%2B%2B-annotations 13.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,576 kB
  • sloc: cpp: 25,297; makefile: 1,523; ansic: 165; sh: 126; perl: 90; fortran: 27
file content (43 lines) | stat: -rw-r--r-- 2,259 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Traditionally system header files were included to declare classes like
tt(std::string) and tt(std:ostream). But when using modules including headers
is deprecated and instead their module-compiled equivalents should be imported
using tt(import) statements.

    hi(module: system header) 
To avoid recompiling system header files for different projects consider
storing module-compiled headers in tt(/usr/include/c++/14) (here, '14' is
tt(g++'s) main version number: update it to your actually installed
version). Using the procedure described in this section project source files
can import module-compiled system headers (assuming that projects have defined
tt(./gcm.cache) directories as described in the previous section).
    itemization(
    it() In the project's tt(gcm.cache) directory define the soft-link 
        tt(usr -> /usr); 
    it() To construct the module-compiled version of a system header file
        (e.g., tt(iostream -> iostream.gcm)) then as execute em(root) in
        tt(/usr/include/c++/14) execute the command
 verb(    g++ --std=c++26 -fmodules-ts -x c++-system-header iostream)
       (if the bf(C++) standard isn't tt(c++26) then adapt it to the 
        bf(C++) standard that should be used)
    it() Then move the file tt(iostream.gcm) to the current directory:
 verb(    mv gcm.cache/usr/include/c++/14/iostream.gcm .)
    )

The same procedure can also be used to module-comile header files of installed
libraries. E.g., the bf(bobcat)(7) library stores its headers in
tt(/usr/include/bobcat). To module-compile its tt(arg) header file:
    itemization(
    itt(cd /usr/include)
    itt(g++ --std=c++26 -fmodules-ts -x c++-system-header bobcat/arg)
    itt(mv gcm.cache/usr/include/bobcat/arg.gcm bobcat/)
    )

Note: currently (using tt(g++) version 14.2.0) compilation sequence issues may
be encountered when module-compiling system headers. For some system headers
module-compilation fails if some other module-compiled system headers are
already available. Those issues can usually be `solved' by first moving all
existing .gcm files to, e.g., a tt(./tmp) sub-directory, followed by the
module-compilation of the intended system header file, and then moving the
tt(tmp/*.gcm) files back to the current directory.