diff --git a/src/core/model/object-base.cc b/src/core/model/object-base.cc index 65cc54c1f..14d61f81e 100644 --- a/src/core/model/object-base.cc +++ b/src/core/model/object-base.cc @@ -35,6 +35,10 @@ namespace ns3 { +// Explicit instantiation declaration +template Callback MakeCallback(ObjectBase* (*)()); +template Callback::Callback(); +template class CallbackImpl; NS_LOG_COMPONENT_DEFINE("ObjectBase"); diff --git a/src/core/model/object-base.h b/src/core/model/object-base.h index 66aa4be1c..c496531cb 100644 --- a/src/core/model/object-base.h +++ b/src/core/model/object-base.h @@ -335,6 +335,15 @@ class ObjectBase const AttributeValue& value); }; +// The following explicit template instantiation declarations prevent all the translation +// units including this header file to implicitly instantiate the callbacks class and +// function templates having ObjectBase as template type parameter that are required to be +// instantiated more often (accorging to the ClangBuildAnalyzer tool). +// These classes and functions are explicitly instantiated in object-base.cc +extern template Callback MakeCallback(ObjectBase* (*)()); +extern template Callback::Callback(); +extern template class CallbackImpl; + } // namespace ns3 #endif /* OBJECT_BASE_H */