Fix error when a C++ program is linked with libkeyutils 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> Signed-off-by: David Howells <dhowells@redhat.com>
diff --git a/keyutils.h b/keyutils.h index 8b34353..3f672bc 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[]; @@ -271,4 +275,8 @@ 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 */