X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fplugin%2Fplugin.c;h=59b8727381c2c59efa39d183bb1e91544c5c68f7;hb=07208d85d16704b304b371897bb7acc995fcc481;hp=8a4e055564b902300e889b6be3660f5e631691b9;hpb=a77aed144d7db38bbdb3df37261431ecc6b87749;p=babeltrace.git diff --git a/lib/plugin/plugin.c b/lib/plugin/plugin.c index 8a4e0555..59b87273 100644 --- a/lib/plugin/plugin.c +++ b/lib/plugin/plugin.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -60,13 +61,20 @@ static struct bt_plugin_set *(*bt_plugin_python_create_all_from_file_sym)(const char *path) = bt_plugin_python_create_all_from_file; + +static +void init_python_plugin_provider(void) {} #else /* BT_BUILT_IN_PYTHON_PLUGIN_SUPPORT */ static GModule *python_plugin_provider_module; static struct bt_plugin_set *(*bt_plugin_python_create_all_from_file_sym)(const char *path); -__attribute__((constructor)) static +static void init_python_plugin_provider(void) { + if (bt_plugin_python_create_all_from_file_sym != NULL) { + return; + } + BT_LOGD_STR("Loading Python plugin provider module."); python_plugin_provider_module = g_module_open(PYTHON_PLUGIN_PROVIDER_FILENAME, 0); @@ -169,6 +177,7 @@ struct bt_plugin_set *bt_plugin_create_all_from_file(const char *path) } /* Try Python plugins if support is available */ + init_python_plugin_provider(); if (bt_plugin_python_create_all_from_file_sym) { plugin_set = bt_plugin_python_create_all_from_file_sym(path); if (plugin_set) { @@ -705,8 +714,8 @@ struct bt_component_class *bt_plugin_get_component_class_by_name_and_type( enum bt_component_class_type comp_class_cand_type = bt_component_class_get_type(comp_class_candidate); - assert(comp_class_cand_name); - assert(comp_class_cand_type >= 0); + BT_ASSERT(comp_class_cand_name); + BT_ASSERT(comp_class_cand_type >= 0); if (strcmp(name, comp_class_cand_name) == 0 && comp_class_cand_type == type) {