From ec974f60cbfa3814c5d654a0f77f0b27a6cc5d94 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 17 Jun 2024 14:35:59 +0200 Subject: Don't instantiate templates before declaration, add missing instantiation (#706) In C++ explicit template instantiations need to be done AFTER template declarations are made. --- primedev/squirrel/squirrel.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/primedev/squirrel/squirrel.cpp b/primedev/squirrel/squirrel.cpp index 41a6a782..f6df0c5f 100644 --- a/primedev/squirrel/squirrel.cpp +++ b/primedev/squirrel/squirrel.cpp @@ -157,11 +157,6 @@ const char* SQTypeNameFromID(int type) return ""; } -// needed to define implementations for squirrelmanager outside of squirrel.h without compiler errors -template class SquirrelManager; -template class SquirrelManager; -template class SquirrelManager; - template void SquirrelManager::VMCreated(CSquirrelVM* newSqvm) { m_pSQVM = newSqvm; @@ -845,3 +840,12 @@ void InitialiseSquirrelManagers() g_pSquirrel = new SquirrelManager; g_pSquirrel = new SquirrelManager; } + +// needed to define implementations for squirrelmanager outside of squirrel.h without compiler errors +template class SquirrelManager; +template class SquirrelManager; +template class SquirrelManager; + +template std::shared_ptr NS::log::squirrel_logger(); +template std::shared_ptr NS::log::squirrel_logger(); +template std::shared_ptr NS::log::squirrel_logger(); -- cgit v1.2.3