Technical data

Cray Standard C/C++ Reference Manual
of -h prelink_copy_if_nonlocal (see Section 2.5.8, page 13) will work as if
you created a library (.a) that is shared.
The -h prelink_local_copy option indicates that only local files (for
example, files in the current directory) are candidates for assignment of
instantiations. This option is useful when you are sharing some common
relocatables but do not want them updated. Another way to ensure that shared
.o files are not updated is to use the -h remove_instantiation_flags
option when compiling the shared .o files. This also makes smaller resulting
shared .o files.
An easy way to create a library that instantiates all references of templates within
the library is to create an empty main function and link it with the library, as
shown in the following example. The prelinker will instantiate those template
references that are within the library to one of the relocatables without generating
duplicates. The empty dummy_main.o file is removed prior to creating the
.a file.
CC a.C b.C c.C dummy_main.C
bld -q mylib.a a.o b.o c.o
Another alternative to creating a library that instantiates all references of
templates, is to use the -h one_instantiation_per_object option. This
option directs the prelinker to instantiate each template referenced within a
library in its own object file. The following example shows how to use the option:
CC -h one_instantiation_per_object a.C b.C c.C dummy_main.C
bld -q mylib.a a.o b.o c.o myInstantiationsDir/*.int.o
For more information about this alternative see Section 6.3, page 114 and Section
2.5.2, page 12.
If a specialization of a template entity is provided somewhere in the program,
the specialization is seen as a definition by the prelinker. Because that definition
satisfies the references to that entity, the prelinker will not request an instantiation
of the entity. If a specialization of a template is added to a previously compiled
program, the prelinker removes the assignment of the instantiation from the
proper .ii file.
The .ii files do not, in general, require any manual intervention. The exception
occurs when a definition is changed in such a way that some instantiation no
longer compiles (it receives errors) and at the same time a specialization is added
to another file and the first file is recompiled before the specialization file. If this
exception occurs, the .ii file that corresponds to the file that generated the
errors must be deleted manually to allow the prelinker to regenerate it.
112 S217936