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

Alistair Popple alistair at popple.id.au
Tue Mar 26 11:56:35 AEDT 2019


Thanks Artem, and sorry for the delay merging this. Should be upstream now.

- Alistair

On Friday, 22 February 2019 4:06:08 PM AEDT Artem Senichev wrote:
> 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"




More information about the Pdbg mailing list