]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dlfcn-util: add DLSYM_ARG() helper
authorLennart Poettering <lennart@poettering.net>
Mon, 30 Nov 2020 16:22:35 +0000 (17:22 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 4 Dec 2020 09:41:59 +0000 (10:41 +0100)
src/basic/dlfcn-util.h

index 2c94ed51f34408ee6e908348fbf6631b8d2ca56a..e0944f3aaf47e41e676eb7038bb4052309c77e41 100644 (file)
@@ -8,3 +8,9 @@
 DEFINE_TRIVIAL_CLEANUP_FUNC(void*, dlclose);
 
 int dlsym_many_and_warn(void *dl, int level, ...);
+
+/* Macro useful for putting together variable/symbol name pairs when calling dlsym_many_and_warn(). Assumes
+ * that each library symbol to resolve will be placed in a variable with the "sym_" prefix, i.e. a symbol
+ * "foobar" is loaded into a variable "sym_foobar". */
+#define DLSYM_ARG(arg) \
+        &sym_##arg, STRINGIFY(arg)