diff mbox series

[libubootenv] libuboot: wrap libuboot in extern "C" for C++

Message ID 1576064714-27629-1-git-send-email-pjtexier@koncepto.io
State Superseded
Headers show
Series [libubootenv] libuboot: wrap libuboot in extern "C" for C++ | expand

Commit Message

'Darko Komljenovic' via swupdate Dec. 11, 2019, 11:45 a.m. UTC
This allows linking from C++ applications without the need of using
extern "C" when including libuboot header file.
This follows the guide line of many other libraries.

Fixes:

 foo.cpp:(.text+0x19) : undefined reference to « libuboot_initialize(uboot_ctx**, uboot_env_device*) »
 ...

Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
---
 src/libuboot.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/src/libuboot.h b/src/libuboot.h
index 227e022..e55b149 100644
--- a/src/libuboot.h
+++ b/src/libuboot.h
@@ -5,6 +5,9 @@ 
  * SPDX-License-Identifier:     LGPL-2.1-or-later
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #pragma once
 
@@ -153,3 +156,7 @@  const char *libuboot_getname(void *entry);
  * @return pointer to name or NULL
  */
 const char *libuboot_getvalue(void *entry);
+
+#ifdef __cplusplus
+}
+#endif