From ae61eef10ad54fdad1b0ac4bfc220c5b54f42910 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 5 Nov 2023 00:26:46 +0000 Subject: [PATCH] Ensure names are not mangled when used with C++ --- include/argparse.h | 8 ++++++++ include/darr.h | 8 ++++++++ include/io.h | 8 ++++++++ include/pak.h | 8 ++++++++ include/pckr.h | 8 ++++++++ include/test_utils.h | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/include/argparse.h b/include/argparse.h index f970226..53b2e12 100644 --- a/include/argparse.h +++ b/include/argparse.h @@ -1,6 +1,10 @@ #ifndef ARGPARSE_H #define ARGPARSE_H +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + #include "aliases.h" #include #include @@ -17,4 +21,8 @@ typedef struct { argparser_t parse_args(i32 argc, char *argv[]); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !ARGPARSE_H diff --git a/include/darr.h b/include/darr.h index f400c87..ad47b37 100644 --- a/include/darr.h +++ b/include/darr.h @@ -1,6 +1,10 @@ #ifndef D_ARR_H #define D_ARR_H +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + #include "aliases.h" #include @@ -13,4 +17,8 @@ i64 darr_add(darr_t **darr, void *item); void **darr_get_items(darr_t *darr); void darr_free(darr_t **darr); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !D_ARR_H diff --git a/include/io.h b/include/io.h index 280a49e..c768c95 100644 --- a/include/io.h +++ b/include/io.h @@ -1,6 +1,10 @@ #ifndef IO_H #define IO_H +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + #include "aliases.h" #include #include @@ -21,4 +25,8 @@ u64 get_file_length(FILE *fp); void read_entire_file(void *dst, FILE *fp); dirwalk_result_t walk_dir(dirwalk_t **dirwalk, const char *filepath); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !IO_H diff --git a/include/pak.h b/include/pak.h index 12e4cb5..ed1db7b 100644 --- a/include/pak.h +++ b/include/pak.h @@ -1,6 +1,10 @@ #ifndef PAK_H #define PAK_H +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + #include "aliases.h" #include @@ -45,4 +49,8 @@ buf_t *read_file_from_pack(asset_pack_t *pack, const char *filename); void close_pack_file(buf_t **buf); void close_asset_pack(asset_pack_t **pack); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !PAK_H diff --git a/include/pckr.h b/include/pckr.h index f1e4513..350a48a 100644 --- a/include/pckr.h +++ b/include/pckr.h @@ -1,8 +1,16 @@ #ifndef PCKR_H #define PCKR_H +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + #include "aliases.h" i32 run_pckr(i32 argc, char *argv[]); +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !PCKR_H diff --git a/include/test_utils.h b/include/test_utils.h index 0c1b685..22b41d7 100644 --- a/include/test_utils.h +++ b/include/test_utils.h @@ -1,6 +1,10 @@ #ifndef TEST_UTILS_H #define TEST_UTILS_H +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + #define ARRLEN(ARR) (sizeof ARR / sizeof ARR[0]) typedef struct { @@ -8,4 +12,8 @@ typedef struct { const char *contents; } asset_t; +#ifdef __cplusplus +} +#endif // __cplusplus + #endif // !TEST_UTILS_H