/** Number of features in critical plugins that failed to load */
int critical;
} stats;
+
+ /**
+ * Fetch features from the given plugin, can optionally be overridden to
+ * modify feature arrays at loading time
+ */
+ int (*get_features)(plugin_t *plugin, plugin_feature_t *features[]);
};
/**
enumerator->destroy(enumerator);
}
+/**
+ * Default implementation for plugin feature retrieval
+ */
+static int get_features_default(plugin_t *plugin, plugin_feature_t *features[])
+{
+ return plugin->get_features(plugin, features);
+}
+
/**
* Register plugin features provided by the given plugin
*/
return;
}
reg = NULL;
- count = entry->plugin->get_features(entry->plugin, &feature);
+ count = this->get_features(entry->plugin, &feature);
for (i = 0; i < count; i++)
{
switch (feature->kind)
.features = hashlist_create(
(hashtable_hash_t)registered_feature_hash,
(hashtable_equals_t)registered_feature_equals, 64),
+ .get_features = dlsym(RTLD_DEFAULT, "plugin_loader_feature_filter"),
);
+ if (!this->get_features)
+ {
+ this->get_features = get_features_default;
+ }
+
return &this->public;
}