1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
When using modules the module interface units must be compiled before other
sources using the modules or implementing their components can be
compiled. This also holds true for partition interface units (cf. section
ref(PARTITIONS)). When a module interface unit is compiled the compiler stores
the module's tt(.gcm) file (the equivalent of a compiled header file) in the
ti(gcm.cache) sub-directory of the module interface unit. If the module's name
is tt(Square), defined in the tt(modsquare.cc) source file then the compiler
produces tt(gcm.cache/Sqaure.gcm) as well as the tt(modsquare.o) object
file. The tt(.gcm) file must be available to any source file importing the
module or implementing one of the module's components.
Usually projects define several sub-directories, and files in those
sub-directories (as well as files in the top-level directory) may import
modules defined in other sub-directories. To ensure that module-compiled
interface units are available to all of the program's source files the
following setup can be adopted:
itemization(
it() The top-level directory defines a tt(gcm.cache) sub-directory
it() Each of the project's sub-directories defines a soft-link
tt(gcm.cache -> ../gcm.cache)
)
This setup works fine as long as all the project's modules have different
names, but that by itself is a good design principle.
|