Move to kernel style SPDX license identifiers
[babeltrace.git] / src / lib / plugin / plugin-so.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
5 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 */
7
8 #ifndef BABELTRACE_PLUGIN_PLUGIN_SO_INTERNAL_H
9 #define BABELTRACE_PLUGIN_PLUGIN_SO_INTERNAL_H
10
11 #include <glib.h>
12 #include <gmodule.h>
13 #include <stdbool.h>
14 #include <babeltrace2/types.h>
15 #include "common/macros.h"
16
17 struct bt_plugin;
18 struct bt_component_class;
19
20 struct bt_plugin_so_shared_lib_handle {
21 struct bt_object base;
22 GString *path;
23 GModule *module;
24
25 /* True if initialization function was called */
26 bt_bool init_called;
27 bt_plugin_finalize_func exit;
28 };
29
30 struct bt_plugin_so_spec_data {
31 /* Shared lib. handle: owned by this */
32 struct bt_plugin_so_shared_lib_handle *shared_lib_handle;
33
34 /* Pointers to plugin's memory: do NOT free */
35 const struct __bt_plugin_descriptor *descriptor;
36 bt_plugin_initialize_func init;
37 const struct __bt_plugin_descriptor_version *version;
38 };
39
40 BT_HIDDEN
41 int bt_plugin_so_create_all_from_file(const char *path,
42 bool fail_on_load_error, struct bt_plugin_set **plugin_set_out);
43
44 BT_HIDDEN
45 int bt_plugin_so_create_all_from_static(bool fail_on_load_error,
46 struct bt_plugin_set **plugin_set_out);
47
48 /*
49 * This function would normally be BT_HIDDEN, but it is used by the Python
50 * plugin provider, which is conceptually part of libbabeltrace2, but
51 * implemented as a separate shared object, for modularity. It is therefore
52 * exposed, but not part of the public ABI.
53 */
54 void bt_plugin_so_on_add_component_class(struct bt_plugin *plugin,
55 struct bt_component_class *comp_class);
56
57 #endif /* BABELTRACE_PLUGIN_PLUGIN_SO_INTERNAL_H */
This page took 0.029558 seconds and 4 git commands to generate.