Skip to content

Commit 9aac2e4

Browse files
committed
Update static plugin registry integration
1 parent 200009a commit 9aac2e4

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎include/stdcorelib/plugin/plugin.h‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,7 @@ namespace stdc::plugin {
7171

7272
}
7373

74-
#if !defined(STDC_PLUGIN_LIBRARY) && defined(_MSC_VER)
75-
// MSVC needs the dllimport declaration when inline registry code references the
76-
// exported _head and _tail data members. GNU-family compilers must instantiate
77-
// AddFactory locally because an outer explicit instantiation does not instantiate
78-
// the nested class.
79-
extern template class STDC_PLUGIN_EXPORT stdc::StaticRegistry<stdc::plugin::StaticPlugin>;
80-
#endif
74+
STDC_DECLARE_EXPORTED_STATIC_REGISTRY(stdc::plugin::StaticPlugin, STDC_PLUGIN_EXPORT)
8175

8276
/// The entry-point symbol exported by a dynamic plugin.
8377
#define STDC_PLUGIN_INSTANCE_SYMBOL "stdc_plugin_instance"

‎src/plugin/pluginfactory.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace fs = std::filesystem;
2020

21-
STDC_INSTANTIATE_STATIC_REGISTRY_EXPORT(stdc::plugin::StaticPlugin, STDC_PLUGIN_EXPORT)
21+
STDC_STATIC_REGISTRY(stdc::plugin::StaticPlugin)
2222

2323
namespace stdc::plugin {
2424

‎src/plugin/pluginloader.cpp‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,19 @@ namespace stdc::plugin {
244244
PluginLoader::PluginLoader(const std::filesystem::path &filePath,
245245
const std::optional<std::filesystem::path> &metadataPath)
246246
: PluginLoader() {
247-
_impl->readLibrary(filePath, metadataPath);
247+
stdc_impl_t;
248+
impl.readLibrary(filePath, metadataPath);
248249
}
249250

250251
PluginLoader::PluginLoader(const StaticPlugin &plugin) : PluginLoader() {
251-
_impl->setStaticPlugin(plugin);
252+
stdc_impl_t;
253+
impl.setStaticPlugin(plugin);
252254
}
253255

254256
PluginLoader::PluginLoader(std::string_view iid, Plugin *plugin, const json::Value &metadata)
255257
: PluginLoader() {
256-
_impl->setRuntimePlugin(iid, plugin, metadata);
258+
stdc_impl_t;
259+
impl.setRuntimePlugin(iid, plugin, metadata);
257260
}
258261

259262
PluginLoader::~PluginLoader() = default;

0 commit comments

Comments
 (0)