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
|
Once the local library's headers and module-compiled headers are available via
the local library's tt(hdr) sub-directory they can be imported by source
files which do not belong to the library.
Suppose the library's header files are imported by tt(main.cc), defined in the
directory tt(~/project):
verbinclude(-as4 examples/locallibabs/main.cc)
Furthermore, assume the local library's top-level directory is
tt(~/support/locallib) (and so tt(~/support/locallib/hdrs) contains the
soft-links to its header files and module-compiled header files).
To make the library's headers available to tt(main.cc) two soft-links to
relative destinations can be defined:
itemization(
it() in tt(~/project) define a soft-link to the library's tt(hdrs)
directory:
verb( ln -s ../support/locallib/hdrs .)
it() in the tt(~/project/gcm.cache/,/) (note: comma!) sub-directory define
a soft-link to the just defined tt(hdrs) soft-link:
verb( ln -s ../../hdrs .)
)
Once these links are available tt(main.cc) can be compiled using
verb( g++ -c --std=c++26 -fmodules-ts -isystem hdrs main.cc)
itemization(
it() In practice the program using the library's headers also needs linker
options: these are used as always, and need no further modifications.
it() The soft-links must be relative links: if the local library's tt(hdr)
is located in a completely different location then the soft-link
tt(~/project/hdrs) must point to that directory using a relative path
specification.
it() The names of the two soft-links must be identical, but the name of
the project's soft-link to the library's tt(hdrs) directory does not
have to be tt(hdrs).
)
|