plugin-loader: Don't prevent dynamic linking in addition to static constructors

When built with static plugins and constructors, we might still want to
be able to load external plugins.

Fixes: d860c26e95 ("plugin-loader: Properly support compilation without dlopen()/dlsym() etc.")
This commit is contained in:
Tobias Brunner
2025-08-22 15:32:39 +02:00
parent e9fa338e23
commit 1b551a9bfd
+5 -3
View File
@@ -46,6 +46,9 @@ typedef struct plugin_entry_t plugin_entry_t;
* Statically registered constructors * Statically registered constructors
*/ */
static hashtable_t *plugin_constructors = NULL; static hashtable_t *plugin_constructors = NULL;
#elif !defined(HAVE_DLADDR)
#error Neither dynamic linking nor static plugin constructors are supported!
#endif #endif
/** /**
@@ -373,13 +376,12 @@ static status_t create_plugin(private_plugin_loader_t *this, void *handle,
{ {
constructor = plugin_constructors->get(plugin_constructors, name); constructor = plugin_constructors->get(plugin_constructors, name);
} }
#elif defined(HAVE_DLADDR) #endif
#ifdef HAVE_DLADDR
if (!constructor) if (!constructor)
{ {
constructor = dlsym(handle, create); constructor = dlsym(handle, create);
} }
#else
#error Neither dynamic linking nor static plugin constructors are supported!
#endif #endif
if (!constructor) if (!constructor)
{ {