-qunique
Category
Pragma equivalent
None.
Purpose
Generates unique names for static constructor/destructor file compilation units.
Defaults
-qnounique
Usage
Unique names are generated with -qunique by encoding random numbers into the name of the static constructor and destructor functions. Default behavior is encoding the absolute path name of the source file in the constructor and destructor functions. If the absolute path name will be identical for multiple compilations (for example, if a make script is used), the -qunique option is necessary.
If you use -qunique, you must always link with all .o and .a files. Do not include an executable file on the link step.
Predefined macros
None.
Examples
Suppose you want to compile several
files using the same path name, ensuring that static construction
works correctly. A makefile may generate the following steps:
sqlpreprocess file1.sql > t.C
xlc++ -qunique t.C -o file1.o
rm -f t.C
sqlpreprocess file2.sql > t.C
xlc++ -qunique t.C -o file2.o
rm -f t.C
xlc++ file1.o file2.o
The following code is a
sample makefile for the above example:
# rule to get from file.sql to file.o
.SUFFIXES: .sql
.sql.o:
sqlpreprocess $< > t.C
$(CCC) t.C -c $(CCFLAGS) -o $@
rm -f t.C



