summaryrefslogtreecommitdiff
path: root/libnm-util/nm-utils.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-07-25 17:50:14 -0400
committerDan Winship <danw@gnome.org>2014-08-01 14:34:40 -0400
commitd7b56c7b7eee2d93411433dcca53e4bb49f59f68 (patch)
tree9aa229f449369bb116ab90f350385d8845db339d /libnm-util/nm-utils.c
parentd0b05b34d5f1ad8f52a15fed48cc2c02d2251145 (diff)
downloadNetworkManager-d7b56c7b7eee2d93411433dcca53e4bb49f59f68.tar.gz
libnm, libnm-utils: error out if mixed libnm/libnm-util symbols are detected
If a program accidentally ends up linking in both libnm and libnm-util (presumably via different dependencies), error out immediately.
Diffstat (limited to 'libnm-util/nm-utils.c')
-rw-r--r--libnm-util/nm-utils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c
index 9c96601c90..a5113538dd 100644
--- a/libnm-util/nm-utils.c
+++ b/libnm-util/nm-utils.c
@@ -26,6 +26,7 @@
#include <netinet/ether.h>
#include <linux/if_infiniband.h>
#include <uuid/uuid.h>
+#include <gmodule.h>
#include "nm-utils.h"
#include "nm-utils-private.h"
@@ -202,6 +203,18 @@ get_encodings_for_lang (const char *lang,
/* init, deinit for libnm_util */
+static void __attribute__((constructor))
+_check_symbols (void)
+{
+ GModule *self;
+ gpointer func;
+
+ self = g_module_open (NULL, 0);
+ if (g_module_symbol (self, "nm_device_state_get_type", &func))
+ g_error ("libnm symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported");
+ g_module_close (self);
+}
+
static gboolean initialized = FALSE;
/**