...but still dynamically linking against the core lib But the actual template instantiations happen now within the two compilation units, which are linked statically. When looking into the symbol table, we can see that the static field is emitted two times readelf -W target/clang-static-init -s | c++filt |less
35 lines
421 B
C++
35 lines
421 B
C++
|
|
#include "clang-static-init.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
using proc::ConfigResolver;
|
|
using std::cout;
|
|
using std::endl;
|
|
|
|
|
|
namespace test {
|
|
|
|
|
|
int Subject::cnt = 0;
|
|
|
|
Subject::Subject()
|
|
{
|
|
++cnt;
|
|
std::cout << "Subject("<<cnt<<")\n";
|
|
}
|
|
|
|
|
|
namespace {
|
|
Holder<Subject> fab2;
|
|
}
|
|
|
|
|
|
ConfigResolver&
|
|
fabricate()
|
|
{
|
|
return ConfigResolver::instance();
|
|
}
|
|
|
|
|
|
} // namespace test
|