[Pdbg] [PATCH] api: Fix API interface for external usage

Artem Senichev artemsen at gmail.com
Sat Feb 23 00:06:08 AEDT 2019


1. File 'ccan/short_types/short_types.h' is not used by external interface
and should be used as internal dependency only (ccan directory is not
installed by make script).
2. Extern "C" declaration of API allows us to call libpdbg functions
from C++ modules.

Signed-off-by: Artem Senichev <artemsen at gmail.com>
---
 libpdbg/libpdbg.h | 8 +++++++-
 libpdbg/target.h  | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index ee8437f..a24777b 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -8,7 +8,9 @@
 
 #include <stdbool.h>
 
-#include <ccan/short_types/short_types.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct pdbg_target;
 struct pdbg_target_class;
@@ -241,4 +243,8 @@ void pdbg_set_logfunc(pdbg_log_func_t fn);
 void pdbg_set_loglevel(int loglevel);
 void pdbg_log(int loglevel, const char *fmt, ...);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/libpdbg/target.h b/libpdbg/target.h
index 16ae304..3d10a45 100644
--- a/libpdbg/target.h
+++ b/libpdbg/target.h
@@ -20,6 +20,7 @@
 #include <ccan/list/list.h>
 #include <ccan/str/str.h>
 #include <ccan/container_of/container_of.h>
+#include <ccan/short_types/short_types.h>
 #include "compiler.h"
 #include "libpdbg.h"
 
-- 
2.20.1



More information about the Pdbg mailing list