Keyrings Archive on lore.kernel.org
 help / color / Atom feed
From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
To: keyrings@vger.kernel.org
Cc: "David Howells" <dhowells@redhat.com>,
	"Stephan Müller" <smueller@chronox.de>,
	"Christophe Vu-Brugier" <cvubrugier@fastmail.fm>
Subject: [PATCH 4/4] Fix error when a C++ program is linked with libkeyutils
Date: Thu, 02 Jul 2020 08:57:23 +0000
Message-ID: <20200702085723.7026-5-cvubrugier@fastmail.fm> (raw)
In-Reply-To: <20200702085723.7026-1-cvubrugier@fastmail.fm>

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 --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 */
-- 
2.27.0

  parent reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02  8:57 [PATCH 0/4] keyutils: fix compilation error with C++ Christophe Vu-Brugier
2020-07-02  8:57 ` [PATCH 1/4] man: fix typos Christophe Vu-Brugier
2020-07-02  8:57 ` [PATCH 2/4] Fix compilation error when keyutils.h is used in C++ Christophe Vu-Brugier
2020-07-02  8:57 ` [PATCH 3/4] Check that keyutils.h has valid C++ syntax at build time Christophe Vu-Brugier
2020-07-02  8:57 ` Christophe Vu-Brugier [this message]
2020-07-06 20:27 ` [PATCH 0/4] keyutils: fix compilation error with C++ David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200702085723.7026-5-cvubrugier@fastmail.fm \
    --to=cvubrugier@fastmail.fm \
    --cc=dhowells@redhat.com \
    --cc=keyrings@vger.kernel.org \
    --cc=smueller@chronox.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Keyrings Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/keyrings/0 keyrings/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 keyrings keyrings/ https://lore.kernel.org/keyrings \
		keyrings@vger.kernel.org
	public-inbox-index keyrings

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.keyrings


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git