Skip to content

Commit

Permalink
Make libsubid more easily usable from C++
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
alois31 authored and hallyn committed Jan 19, 2022
1 parent f1f1678 commit 9a780cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libsubid/subid.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ enum subid_status {
SUBID_STATUS_ERROR = 3,
};

#ifdef __cplusplus
extern "C" {
#endif

/*
* subid_init: initialize libsubid
*
Expand Down Expand Up @@ -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

0 comments on commit 9a780cf

Please sign in to comment.