From 6fc0b2987eb3ccba8c5c47e467520b272c9a4567 Mon Sep 17 00:00:00 2001 From: Abdelrahman Said Date: Thu, 21 Mar 2024 23:06:27 +0000 Subject: [PATCH] Add extern "C" to all header files --- cpath/include/cpath.h | 8 ++++++++ dstr/include/dstr.h | 8 ++++++++ mem/include/arena/mem_arena.h | 8 ++++++++ mem/include/util/mem_utils.h | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/cpath/include/cpath.h b/cpath/include/cpath.h index baa7b4a..424c4be 100644 --- a/cpath/include/cpath.h +++ b/cpath/include/cpath.h @@ -3,6 +3,10 @@ #include "aliases.h" +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + #define NUMPARTS(...) \ (sizeof((const char *[]){"", __VA_ARGS__}) / sizeof(const char *) - 1) @@ -14,4 +18,8 @@ void join_path(char *dst, u64 count, ...); void dirup(char *dst, u64 levels, const char *path); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !PATH_UTILS_H diff --git a/dstr/include/dstr.h b/dstr/include/dstr.h index 5b779b4..e0368e2 100644 --- a/dstr/include/dstr.h +++ b/dstr/include/dstr.h @@ -3,6 +3,10 @@ #include "aliases.h" +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + typedef struct dstr String; String *wapp_dstr_with_capacity(u64 capacity); @@ -19,4 +23,8 @@ u64 wapp_dstr_length(const String *str); u64 wapp_dstr_capacity(const String *str); const char *wapp_dstr_to_cstr(const String *str); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !DSTR_H diff --git a/mem/include/arena/mem_arena.h b/mem/include/arena/mem_arena.h index c39a956..d314e01 100644 --- a/mem/include/arena/mem_arena.h +++ b/mem/include/arena/mem_arena.h @@ -4,6 +4,10 @@ #include "aliases.h" #include +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + typedef struct growing_arena Arena; bool wapp_mem_arena_init(Arena **arena, u64 base_capacity); @@ -12,4 +16,8 @@ void *wapp_mem_arena_alloc_aligned(Arena *arena, u64 size, u64 alignment); void wapp_mem_arena_clear(Arena *arena); void wapp_mem_arena_free(Arena **arena); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !MEM_ARENA_H diff --git a/mem/include/util/mem_utils.h b/mem/include/util/mem_utils.h index 48b37d1..851117f 100644 --- a/mem/include/util/mem_utils.h +++ b/mem/include/util/mem_utils.h @@ -3,6 +3,14 @@ #include "aliases.h" +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + void *wapp_mem_util_align_forward(void *ptr, u64 alignment); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !MEM_UTILS_H