From 7a7c86fe415b480aed97fe8f3a490c4a409b296d Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Thu, 11 Jun 2026 20:17:01 -0300 Subject: [PATCH] cdylib glue: root plugin implements PluginInterface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit logos_host's module_initializer hard-requires PluginInterface on the root plugin before any provider detection — same bases as the qt glue (QObject, PluginInterface, LogosProviderPlugin). Caught by the first host-loaded run of a cdylib-authored module; the dlopen smoke harness exercised only the C seam. --- cpp-generator/experimental/lidl_gen_cdylib.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cpp-generator/experimental/lidl_gen_cdylib.cpp b/cpp-generator/experimental/lidl_gen_cdylib.cpp index 1408179..f514023 100644 --- a/cpp-generator/experimental/lidl_gen_cdylib.cpp +++ b/cpp-generator/experimental/lidl_gen_cdylib.cpp @@ -413,6 +413,7 @@ QString lidlMakeCdylibGlueHeader(const ModuleDecl& module) s << "// language (C++ or Rust): it only knows the C symbols, which are\n"; s << "// linked in from the module's cdylib. logos_host loads it unchanged.\n"; s << "#pragma once\n\n"; + s << "#include \"interface.h\"\n"; s << "#include \"logos_provider_interface.h\"\n"; s << "#include \"logos_json_convert.h\"\n"; s << "#include \"logos_module_impl.h\"\n"; @@ -440,11 +441,15 @@ QString lidlMakeCdylibGlueHeader(const ModuleDecl& module) s << " static void emitTrampoline(const char* eventName, const char* dataJson, void* userData);\n"; s << "};\n\n"; - s << "class " << className << "CdylibPlugin : public QObject, public LogosProviderPlugin {\n"; + // The root plugin must also implement PluginInterface — logos_host's + // module_initializer hard-requires it before any provider detection. + s << "class " << className << "CdylibPlugin : public QObject, public PluginInterface, public LogosProviderPlugin {\n"; s << " Q_OBJECT\n"; s << " Q_PLUGIN_METADATA(IID LogosProviderPlugin_iid FILE \"metadata.json\")\n"; - s << " Q_INTERFACES(LogosProviderPlugin)\n"; + s << " Q_INTERFACES(PluginInterface LogosProviderPlugin)\n"; s << "public:\n"; + s << " QString name() const override { return QStringLiteral(\"" << module.name << "\"); }\n"; + s << " QString version() const override { return QStringLiteral(\"" << (module.version.isEmpty() ? QStringLiteral("1.0.0") : module.version) << "\"); }\n"; s << " LogosProviderObject* createProviderObject() override {\n"; s << " return new " << className << "CdylibProvider();\n"; s << " }\n";