From 45c1a7091f6386daf2b1075c9fb05d508d94f2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 12 Jun 2022 22:57:37 +0200 Subject: [PATCH] Actually properly export the PluginManager::Manager instances. This is what commit ca722eac6e69896d28b8015bc62384aae2f2e51a should have been. Sorry for breaking a non-deprecated MSVC build once again. The reason it "appeared to work" for me was that on deprecated builds, Manager.h includes Manager.hpp for backwards compatibility. On non-deprecated it doesn't and MSVC ends up dying on a linker error. But the problem was not related to extern templates, the problem was that there was a compiler-specific ifdef in the cpp file which exported the class for all compilers but MSVC, somehow. And so when I removed extern template from the header, it still worked everywhere, except MSVC and except a non-deprecated build. --- src/Magnum/Audio/AbstractImporter.cpp | 10 +--------- src/Magnum/ShaderTools/AbstractConverter.cpp | 10 +--------- src/Magnum/Text/AbstractFont.cpp | 10 +--------- src/Magnum/Text/AbstractFontConverter.cpp | 10 +--------- src/Magnum/Trade/AbstractImageConverter.cpp | 10 +--------- src/Magnum/Trade/AbstractImporter.cpp | 10 +--------- src/Magnum/Trade/AbstractSceneConverter.cpp | 10 +--------- 7 files changed, 7 insertions(+), 63 deletions(-) diff --git a/src/Magnum/Audio/AbstractImporter.cpp b/src/Magnum/Audio/AbstractImporter.cpp index 6b2e19d40..040c9c2cb 100644 --- a/src/Magnum/Audio/AbstractImporter.cpp +++ b/src/Magnum/Audio/AbstractImporter.cpp @@ -42,15 +42,7 @@ namespace Corrade { namespace PluginManager { -/* On non-MinGW Windows the instantiations are already marked with extern - template. However Clang-CL doesn't propagate the export from the extern - template, it seems. */ -#if !defined(CORRADE_TARGET_WINDOWS) || defined(CORRADE_TARGET_MINGW) || defined(CORRADE_TARGET_CLANG_CL) -#define MAGNUM_AUDIO_EXPORT_HPP MAGNUM_AUDIO_EXPORT -#else -#define MAGNUM_AUDIO_EXPORT_HPP -#endif -template class MAGNUM_AUDIO_EXPORT_HPP Manager; +template class MAGNUM_AUDIO_EXPORT Manager; }} diff --git a/src/Magnum/ShaderTools/AbstractConverter.cpp b/src/Magnum/ShaderTools/AbstractConverter.cpp index 54b527bd9..4d3a9596e 100644 --- a/src/Magnum/ShaderTools/AbstractConverter.cpp +++ b/src/Magnum/ShaderTools/AbstractConverter.cpp @@ -43,15 +43,7 @@ namespace Corrade { namespace PluginManager { -/* On non-MinGW Windows the instantiations are already marked with extern - template. However Clang-CL doesn't propagate the export from the extern - template, it seems. */ -#if !defined(CORRADE_TARGET_WINDOWS) || defined(CORRADE_TARGET_MINGW) || defined(CORRADE_TARGET_CLANG_CL) -#define MAGNUM_SHADERTOOLS_EXPORT_HPP MAGNUM_SHADERTOOLS_EXPORT -#else -#define MAGNUM_SHADERTOOLS_EXPORT_HPP -#endif -template class MAGNUM_SHADERTOOLS_EXPORT_HPP Manager; +template class MAGNUM_SHADERTOOLS_EXPORT Manager; }} diff --git a/src/Magnum/Text/AbstractFont.cpp b/src/Magnum/Text/AbstractFont.cpp index 44d989e0c..b88755173 100644 --- a/src/Magnum/Text/AbstractFont.cpp +++ b/src/Magnum/Text/AbstractFont.cpp @@ -45,15 +45,7 @@ namespace Corrade { namespace PluginManager { -/* On non-MinGW Windows the instantiations are already marked with extern - template. However Clang-CL doesn't propagate the export from the extern - template, it seems. */ -#if !defined(CORRADE_TARGET_WINDOWS) || defined(CORRADE_TARGET_MINGW) || defined(CORRADE_TARGET_CLANG_CL) -#define MAGNUM_TEXT_EXPORT_HPP MAGNUM_TEXT_EXPORT -#else -#define MAGNUM_TEXT_EXPORT_HPP -#endif -template class MAGNUM_TEXT_EXPORT_HPP Manager; +template class MAGNUM_TEXT_EXPORT Manager; }} diff --git a/src/Magnum/Text/AbstractFontConverter.cpp b/src/Magnum/Text/AbstractFontConverter.cpp index 1957f3160..02058ee2c 100644 --- a/src/Magnum/Text/AbstractFontConverter.cpp +++ b/src/Magnum/Text/AbstractFontConverter.cpp @@ -45,15 +45,7 @@ namespace Corrade { namespace PluginManager { -/* On non-MinGW Windows the instantiations are already marked with extern - template. However Clang-CL doesn't propagate the export from the extern - template, it seems. */ -#if !defined(CORRADE_TARGET_WINDOWS) || defined(CORRADE_TARGET_MINGW) || defined(CORRADE_TARGET_CLANG_CL) -#define MAGNUM_TEXT_EXPORT_HPP MAGNUM_TEXT_EXPORT -#else -#define MAGNUM_TEXT_EXPORT_HPP -#endif -template class MAGNUM_TEXT_EXPORT_HPP Manager; +template class MAGNUM_TEXT_EXPORT Manager; }} diff --git a/src/Magnum/Trade/AbstractImageConverter.cpp b/src/Magnum/Trade/AbstractImageConverter.cpp index e21af8147..ffc82cbf3 100644 --- a/src/Magnum/Trade/AbstractImageConverter.cpp +++ b/src/Magnum/Trade/AbstractImageConverter.cpp @@ -46,15 +46,7 @@ namespace Corrade { namespace PluginManager { -/* On non-MinGW Windows the instantiations are already marked with extern - template. However Clang-CL doesn't propagate the export from the extern - template, it seems. */ -#if !defined(CORRADE_TARGET_WINDOWS) || defined(CORRADE_TARGET_MINGW) || defined(CORRADE_TARGET_CLANG_CL) -#define MAGNUM_TRADE_EXPORT_HPP MAGNUM_TRADE_EXPORT -#else -#define MAGNUM_TRADE_EXPORT_HPP -#endif -template class MAGNUM_TRADE_EXPORT_HPP Manager; +template class MAGNUM_TRADE_EXPORT Manager; }} diff --git a/src/Magnum/Trade/AbstractImporter.cpp b/src/Magnum/Trade/AbstractImporter.cpp index f8831e1e1..f5d012d3c 100644 --- a/src/Magnum/Trade/AbstractImporter.cpp +++ b/src/Magnum/Trade/AbstractImporter.cpp @@ -72,15 +72,7 @@ namespace Corrade { namespace PluginManager { -/* On non-MinGW Windows the instantiations are already marked with extern - template. However Clang-CL doesn't propagate the export from the extern - template, it seems. */ -#if !defined(CORRADE_TARGET_WINDOWS) || defined(CORRADE_TARGET_MINGW) || defined(CORRADE_TARGET_CLANG_CL) -#define MAGNUM_TRADE_EXPORT_HPP MAGNUM_TRADE_EXPORT -#else -#define MAGNUM_TRADE_EXPORT_HPP -#endif -template class MAGNUM_TRADE_EXPORT_HPP Manager; +template class MAGNUM_TRADE_EXPORT Manager; }} diff --git a/src/Magnum/Trade/AbstractSceneConverter.cpp b/src/Magnum/Trade/AbstractSceneConverter.cpp index 309ab7807..b72541173 100644 --- a/src/Magnum/Trade/AbstractSceneConverter.cpp +++ b/src/Magnum/Trade/AbstractSceneConverter.cpp @@ -46,15 +46,7 @@ namespace Corrade { namespace PluginManager { -/* On non-MinGW Windows the instantiations are already marked with extern - template. However Clang-CL doesn't propagate the export from the extern - template, it seems. */ -#if !defined(CORRADE_TARGET_WINDOWS) || defined(CORRADE_TARGET_MINGW) || defined(CORRADE_TARGET_CLANG_CL) -#define MAGNUM_TRADE_EXPORT_HPP MAGNUM_TRADE_EXPORT -#else -#define MAGNUM_TRADE_EXPORT_HPP -#endif -template class MAGNUM_TRADE_EXPORT_HPP Manager; +template class MAGNUM_TRADE_EXPORT Manager; }}