diff mbox series

[4/4] Fix error when a C++ program is linked with libkeyutils

Message ID 20200702085723.7026-5-cvubrugier@fastmail.fm (mailing list archive)
State New
Headers show
Series keyutils: fix compilation error with C++ | expand

Commit Message

Christophe Vu-Brugier July 2, 2020, 8:57 a.m. UTC
Declare all the functions as extern "C" in keyutils.h to instruct a
C++ compiler that these functions are not mangled.

Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
---
 keyutils.h | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/keyutils.h b/keyutils.h
index bdecf15..4ae81d3 100644
--- a/keyutils.h
+++ b/keyutils.h
@@ -15,6 +15,10 @@ 
 #include <sys/types.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern const char keyutils_version_string[];
 extern const char keyutils_build_string[];
 
@@ -268,4 +272,8 @@  extern int recursive_session_key_scan(recursive_key_scanner_t func, void *data);
 extern key_serial_t find_key_by_type_and_desc(const char *type, const char *desc,
 					      key_serial_t destringid);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* KEYUTILS_H */