-#include <dirent.h>
-
-#define PLUGIN_SYMBOL_NAME "__bt_plugin_name"
-#define PLUGIN_SYMBOL_AUTHOR "__bt_plugin_author"
-#define PLUGIN_SYMBOL_LICENSE "__bt_plugin_license"
-#define PLUGIN_SYMBOL_INIT "__bt_plugin_init"
-#define PLUGIN_SYMBOL_EXIT "__bt_plugin_exit"
-#define PLUGIN_SYMBOL_DESCRIPTION "__bt_plugin_description"
-#define NATIVE_PLUGIN_SUFFIX ".so"
-#define NATIVE_PLUGIN_SUFFIX_LEN sizeof(NATIVE_PLUGIN_SUFFIX)
-#define LIBTOOL_PLUGIN_SUFFIX ".la"
-#define LIBTOOL_PLUGIN_SUFFIX_LEN sizeof(LIBTOOL_PLUGIN_SUFFIX)
-
-#define PLUGIN_SUFFIX_LEN max_t(size_t, sizeof(NATIVE_PLUGIN_SUFFIX), \
- sizeof(LIBTOOL_PLUGIN_SUFFIX))
-
-#define SECTION_BEGIN(_name) &__start_##_name
-#define SECTION_END(_name) &__stop_##_name
-#define SECTION_ELEMENT_COUNT(_name) (SECTION_END(_name) - SECTION_BEGIN(_name))
-
-#define DECLARE_SECTION(_type, _name) \
- extern _type const __start_##_name __attribute((weak)); \
- extern _type const __stop_##_name __attribute((weak))
-
-DECLARE_SECTION(bt_plugin_init_func, __bt_plugin_init_funcs);
-DECLARE_SECTION(bt_plugin_exit_func, __bt_plugin_exit_funcs);
-DECLARE_SECTION(const char *, __bt_plugin_names);
-DECLARE_SECTION(const char *, __bt_plugin_authors);
-DECLARE_SECTION(const char *, __bt_plugin_licenses);
-DECLARE_SECTION(const char *, __bt_plugin_descriptions);
-
-#define PRINT_SECTION(_printer, _name) \
- do { \
- _printer("Section " #_name " [%p - %p], (%zu elements)\n", \
- SECTION_BEGIN(_name), SECTION_END(_name), \
- SECTION_ELEMENT_COUNT(_name)); \
- } while (0)
-
-#define PRINT_PLUG_IN_SECTIONS(_printer) \
- do { \
- PRINT_SECTION(_printer, __bt_plugin_init_funcs); \
- PRINT_SECTION(_printer, __bt_plugin_exit_funcs); \
- PRINT_SECTION(_printer, __bt_plugin_names); \
- PRINT_SECTION(_printer, __bt_plugin_authors); \
- PRINT_SECTION(_printer, __bt_plugin_licenses); \
- PRINT_SECTION(_printer, __bt_plugin_descriptions); \
- } while (0)