Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct possible ODR violations in the AutoInit generated code
The previous `AutoInit` approach generated a class in each TU for a VTK-module. That class would have the same name and the same contents for the constructor. This was fine as long as the VTK-module was built dynamically. This constructor would look like: ```cxx AuotInit() { InitFactory1(); InitFactory2(); } ``` The problem arised when VTK-module's are built statically. In that case we would get multiple differing implementations of the same class. This happens as VTK-module deeper in the hierarchy would would need initialize more factories than VTK-modules they depended on. ```cxx AuotInit() //from VTK-module A { InitFactory1(); InitFactory2(); } AuotInit() //from VTK-module B { InitFactory1(); InitFactory2(); InitFactory3(); InitFactory4(); } ``` These ODR violations are problematic because it meant that the linker would select a single implementation for `AutoInit` which could be one that would only initialized 2 modules instead of one that initialized 4 modules. To solve this problem we have gone with an approach where each AuotInit is placed into an anonymous namespace making them all unique and not an ODR violation.
- Loading branch information