diff --git a/include/libpst.h b/include/libpst.h index 94772d9..b2be6f6 100644 --- a/include/libpst.h +++ b/include/libpst.h @@ -14,6 +14,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #include "libpst-types.h" typedef struct pst_handler pst_handler; @@ -133,4 +137,8 @@ int pst_unwind_pretty(pst_handler* handler); */ const char* pst_print_pretty(pst_handler* handler); +#ifdef __cplusplus +} +#endif + #endif /* __LIBPST_EXTERNAL_H_ */ diff --git a/src/context.c b/src/context.c index ef2844c..9232f8b 100644 --- a/src/context.c +++ b/src/context.c @@ -17,7 +17,7 @@ extern dwarf_reg_map reg_map[]; extern int regnum; -pst_logger logger; // logger for library +pst_logger pstlogger; // logger for library pst_allocator allocator; // custom allocator for PST library static void clean_print(pst_context* ctx) diff --git a/src/context.h b/src/context.h index 03faca1..a090097 100644 --- a/src/context.h +++ b/src/context.h @@ -21,14 +21,14 @@ // uncomment line below to enable debug output to stdout //#define PST_DEBUG -extern pst_logger logger; // logger for whole PST library +extern pst_logger pstlogger; // logger for whole PST library extern pst_allocator allocator; // custom allocator for PST library #define pst_alloc(TYPE) (TYPE*)allocator.alloc(&allocator, sizeof(TYPE)) #define pst_free(NAME) allocator.free(&allocator, NAME) #ifdef PST_DEBUG -#define pst_log(SEVERITY, FORMAT, ...) logger.log(&logger, SEVERITY, FORMAT, ##__VA_ARGS__) +#define pst_log(SEVERITY, FORMAT, ...) pstlogger.log(&logger, SEVERITY, FORMAT, ##__VA_ARGS__) #else #define pst_log(SEVERITY, FORMAT, ...) #endif diff --git a/src/libpst.c b/src/libpst.c index 9451ffa..755e4b4 100644 --- a/src/libpst.c +++ b/src/libpst.c @@ -23,7 +23,7 @@ pst_handler* pst_lib_init(ucontext_t* hctx, void* buff, uint32_t size) pst_alloc_init_custom(&allocator, buff, size); } - pst_log_init_console(&logger); + pst_log_init_console(&pstlogger); pst_new(pst_handler, handler, hctx); @@ -37,7 +37,7 @@ void pst_lib_fini(pst_handler* h) pst_free(h); // global - pst_log_fini(&logger); + pst_log_fini(&pstlogger); pst_alloc_fini(&allocator); }