|
|
The instantiation process may introduce new symbols into the intermediate .o files and final executable file. Those symbols have special names and are used only to pass information along between phases of the compilation process. The special names consist of a prefix, followed by the name of the function or object to be instantiated. The prefix may be one of:
__CBI__ | // Can be instantiated |
__DNI__ | // Do not instantiate |
__TRI__ | // Template instantiation request |
For example, for the following C++ source:
template<class T> T func(T t) { return t; }#pragma instantiate int func(int) #pragma do_not_instantiate double func(double)
int foo() { return func(1) + func(2.0); }
the object file would contain these symbols (from nm -C):
... [6] | 1| 1|OBJT |GLOB |0 |COMMON |__TIR__func(int) [7] | 1| 1|OBJT |GLOB |0 |COMMON |__CBI__func(int) [8] | 1| 1|OBJT |GLOB |0 |COMMON |__TIR__func(double) [9] | 1| 1|OBJT |GLOB |0 |COMMON |__DNI__func(double) [10] | 84| 14|FUNC |GLOB |0 |1 |func(int) [11] | 0| 0|NOTY |GLOB |0 |UNDEF |func(double) [12] | 0| 82|FUNC |GLOB |0 |1 |foo(void)You do not need to be concerned about the meaning of these symbols.