From eedd95bd2f815d55534266902fd96273eec93141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20L=C3=BCke?= Date: Fri, 27 Dec 2024 18:50:40 +0100 Subject: [PATCH] mana auto replay: load both c and cpp plugins --- src/tools/mana_auto_replay.cc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/tools/mana_auto_replay.cc b/src/tools/mana_auto_replay.cc index f66e323..7ba3cfc 100644 --- a/src/tools/mana_auto_replay.cc +++ b/src/tools/mana_auto_replay.cc @@ -413,8 +413,9 @@ int main(int argc, char *argv[]) return 1; } - std::unique_ptr destSink; boost::dll::shared_library pluginHandle; + std::unique_ptr manaCppPlugin; + std::unique_ptr destSink; if (parser("--plugin")) { @@ -422,8 +423,27 @@ int main(int argc, char *argv[]) try { pluginHandle = boost::dll::shared_library(pluginFile); - destSink = std::make_unique( - pluginHandle.get("mana_get_sink_plugin")()); + + try + { + destSink = std::make_unique( + pluginHandle.get("mana_get_sink_plugin")()); + } + catch (const std::exception &e) + { + spdlog::debug("plugin {} is not a MANA_C_SINK_PLUGIN", pluginFile); + try + { + manaCppPlugin = std::unique_ptr( + pluginHandle.get("mana_get_plugin")()); + destSink = manaCppPlugin->makeSink(); + } + catch (const std::exception &e) + { + std::cerr << fmt::format("Error loading plugin: {}\n", e.what()); + return 1; + } + } } catch (const std::exception &e) {