Commit | Line | Data |
---|---|---|
55bb57e0 | 1 | /* |
0235b0db MJ |
2 | * SPDX-License-Identifier: MIT |
3 | * | |
e2f7325d | 4 | * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com> |
55bb57e0 | 5 | * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
55bb57e0 PP |
6 | */ |
7 | ||
0235b0db MJ |
8 | #ifndef BABELTRACE_PLUGIN_PLUGIN_SO_INTERNAL_H |
9 | #define BABELTRACE_PLUGIN_PLUGIN_SO_INTERNAL_H | |
10 | ||
55bb57e0 PP |
11 | #include <glib.h> |
12 | #include <gmodule.h> | |
c4f23e30 | 13 | #include <stdbool.h> |
3fadfbc0 | 14 | #include <babeltrace2/types.h> |
55bb57e0 PP |
15 | |
16 | struct bt_plugin; | |
17 | struct bt_component_class; | |
18 | ||
19 | struct bt_plugin_so_shared_lib_handle { | |
20 | struct bt_object base; | |
21 | GString *path; | |
22 | GModule *module; | |
23 | ||
24 | /* True if initialization function was called */ | |
c55a9f58 | 25 | bt_bool init_called; |
a71c9a60 | 26 | bt_plugin_finalize_func exit; |
55bb57e0 PP |
27 | }; |
28 | ||
29 | struct bt_plugin_so_spec_data { | |
30 | /* Shared lib. handle: owned by this */ | |
31 | struct bt_plugin_so_shared_lib_handle *shared_lib_handle; | |
32 | ||
33 | /* Pointers to plugin's memory: do NOT free */ | |
34 | const struct __bt_plugin_descriptor *descriptor; | |
21a9f056 | 35 | bt_plugin_initialize_func init; |
55bb57e0 PP |
36 | const struct __bt_plugin_descriptor_version *version; |
37 | }; | |
38 | ||
d24d5663 | 39 | int bt_plugin_so_create_all_from_file(const char *path, |
9736d991 | 40 | bool fail_on_load_error, struct bt_plugin_set **plugin_set_out); |
55bb57e0 | 41 | |
d24d5663 | 42 | int bt_plugin_so_create_all_from_static(bool fail_on_load_error, |
9736d991 | 43 | struct bt_plugin_set **plugin_set_out); |
55bb57e0 | 44 | |
3230ee6b | 45 | void bt_plugin_so_on_add_component_class(struct bt_plugin *plugin, |
55bb57e0 PP |
46 | struct bt_component_class *comp_class); |
47 | ||
55bb57e0 | 48 | #endif /* BABELTRACE_PLUGIN_PLUGIN_SO_INTERNAL_H */ |