]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Make libsubid more easily usable from C++
authorAlois Wohlschlager <alois1@gmx-topmail.de>
Wed, 19 Jan 2022 10:39:53 +0000 (11:39 +0100)
committerSerge Hallyn <serge@hallyn.com>
Wed, 19 Jan 2022 16:05:12 +0000 (10:05 -0600)
C++ requires extern "C" linkage specification to call functions from a C
library. Enclose the function definitions in subid.h in an extern "C"
block if compiling in C++ mode to achieve this.

Signed-off-by: Alois Wohlschlager <alois1@gmx-topmail.de>
libsubid/subid.h.in

index 21b22a268ce0a0680661c19ee424fc6a1b9d9369..79744eda1676b707ecdc4cc8e6f67ae36302fba9 100644 (file)
@@ -35,6 +35,10 @@ enum subid_status {
        SUBID_STATUS_ERROR = 3,
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * subid_init: initialize libsubid
  *
@@ -151,5 +155,9 @@ bool subid_ungrant_uid_range(struct subordinate_range *range);
  */
 bool subid_ungrant_gid_range(struct subordinate_range *range);
 
+#ifdef __cplusplus
+}
+#endif
+
 #define SUBID_NFIELDS 3
 #endif