diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2022-12-08 14:37:56 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2023-01-03 13:56:25 +0000 |
commit | 1c4da332ee6e0d948f85a63f74cb27e89075c011 (patch) | |
tree | 03a01bf796b4d435cd233c89ed3d05c562ed3fd1 /src/plugins/mm-plugin-common.h | |
parent | 1dd70be4c834ba025ff16b343aa4032a8c64fb71 (diff) |
build: new option to build plugins within the daemon binary
Instead of creating libmm-plugin* and libmm-shared* libraries that are
dlopen()-ed on runtime, allow incorporating all plugins into the
daemon binary itself.
This makes the startup of the daemon much faster and also avoids
issues with builds that require linker namespace isolation.
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/674
Diffstat (limited to 'src/plugins/mm-plugin-common.h')
-rw-r--r-- | src/plugins/mm-plugin-common.h | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/plugins/mm-plugin-common.h b/src/plugins/mm-plugin-common.h index 607d24db..55e06d7e 100644 --- a/src/plugins/mm-plugin-common.h +++ b/src/plugins/mm-plugin-common.h @@ -26,20 +26,28 @@ #include "mm-plugin.h" -#define MM_PLUGIN_NAMED_CREATOR_SCOPE static +#if defined (G_HAVE_GNUC_VISIBILITY) +# define MM_VISIBILITY __attribute__((visibility("protected"))) +#else +# define MM_VISIBILITY +#endif -#define MM_PLUGIN_CREATOR(my_plugin) \ +#if defined WITH_BUILTIN_PLUGINS +# define MM_PLUGIN_VERSION +# define MM_PLUGIN_NAMED_CREATOR_SCOPE +# define MM_PLUGIN_CREATOR(unused) +#else +# define MM_PLUGIN_VERSION \ + MM_VISIBILITY int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION; \ + MM_VISIBILITY int mm_plugin_minor_version = MM_PLUGIN_MINOR_VERSION; +# define MM_PLUGIN_NAMED_CREATOR_SCOPE static +# define MM_PLUGIN_CREATOR(my_plugin) \ G_MODULE_EXPORT MMPlugin *mm_plugin_create (void); \ G_MODULE_EXPORT MMPlugin * \ mm_plugin_create (void) \ { \ return mm_plugin_create_##my_plugin (); \ } - -#if defined (G_HAVE_GNUC_VISIBILITY) -# define MM_VISIBILITY __attribute__((visibility("protected"))) -#else -# define MM_VISIBILITY #endif #define MM_DEFINE_PLUGIN(MY_PLUGIN, my_plugin, MyPlugin) \ @@ -49,8 +57,7 @@ }; \ G_DEFINE_TYPE (MMPlugin##MyPlugin, mm_plugin_##my_plugin, MM_TYPE_PLUGIN) \ \ - MM_VISIBILITY int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION; \ - MM_VISIBILITY int mm_plugin_minor_version = MM_PLUGIN_MINOR_VERSION; \ + MM_PLUGIN_VERSION \ \ MM_PLUGIN_NAMED_CREATOR_SCOPE MMPlugin *mm_plugin_create_##my_plugin (void); \ MM_PLUGIN_CREATOR(my_plugin) |