Skip to content

Commit 2119f0a

Browse files
authored
Fixed shared_ptr type selection in createSharedInstance (#29)
1 parent 288bf38 commit 2119f0a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

include/boost_plugin_loader/plugin_loader.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ static std::shared_ptr<ClassBase> createSharedInstance(const boost::dll::shared_
5151
throw PluginLoaderException("Failed to find symbol '" + symbol_name +
5252
"' in library: " + boost::dll::shared_library::decorate(lib.location()).string());
5353

54-
#if BOOST_VERSION >= 107600
54+
#if BOOST_VERSION >= 108800
5555
return boost::dll::import_symbol<ClassBase>(lib, symbol_name);
5656
#else
57-
boost::shared_ptr<ClassBase> plugin = boost::dll::import <ClassBase>(lib, symbol_name);
58-
return std::shared_ptr<ClassBase>(plugin.get(), [plugin](ClassBase*) mutable { plugin.reset(); });
57+
#if BOOST_VERSION >= 107600
58+
boost::shared_ptr<ClassBase> plugin = boost::dll::import_symbol<ClassBase>(lib, symbol_name);
59+
#else
60+
boost::shared_ptr<ClassBase> plugin = boost::dll::import <ClassBase>(lib, symbol_name);
61+
#endif
62+
return std::shared_ptr<ClassBase>(plugin.get(), [plugin](ClassBase*) mutable { plugin.reset(); });
5963
#endif
6064
}
6165

0 commit comments

Comments
 (0)