Ensure names are not mangled when used with C++

This commit is contained in:
Abdelrahman Said 2023-11-05 00:26:46 +00:00
parent fb1d1697f1
commit ae61eef10a
6 changed files with 48 additions and 0 deletions

View File

@ -1,6 +1,10 @@
#ifndef ARGPARSE_H #ifndef ARGPARSE_H
#define ARGPARSE_H #define ARGPARSE_H
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "aliases.h" #include "aliases.h"
#include <linux/limits.h> #include <linux/limits.h>
#include <stdbool.h> #include <stdbool.h>
@ -17,4 +21,8 @@ typedef struct {
argparser_t parse_args(i32 argc, char *argv[]); argparser_t parse_args(i32 argc, char *argv[]);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !ARGPARSE_H #endif // !ARGPARSE_H

View File

@ -1,6 +1,10 @@
#ifndef D_ARR_H #ifndef D_ARR_H
#define D_ARR_H #define D_ARR_H
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "aliases.h" #include "aliases.h"
#include <stdbool.h> #include <stdbool.h>
@ -13,4 +17,8 @@ i64 darr_add(darr_t **darr, void *item);
void **darr_get_items(darr_t *darr); void **darr_get_items(darr_t *darr);
void darr_free(darr_t **darr); void darr_free(darr_t **darr);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !D_ARR_H #endif // !D_ARR_H

View File

@ -1,6 +1,10 @@
#ifndef IO_H #ifndef IO_H
#define IO_H #define IO_H
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "aliases.h" #include "aliases.h"
#include <linux/limits.h> #include <linux/limits.h>
#include <stdbool.h> #include <stdbool.h>
@ -21,4 +25,8 @@ u64 get_file_length(FILE *fp);
void read_entire_file(void *dst, FILE *fp); void read_entire_file(void *dst, FILE *fp);
dirwalk_result_t walk_dir(dirwalk_t **dirwalk, const char *filepath); dirwalk_result_t walk_dir(dirwalk_t **dirwalk, const char *filepath);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !IO_H #endif // !IO_H

View File

@ -1,6 +1,10 @@
#ifndef PAK_H #ifndef PAK_H
#define PAK_H #define PAK_H
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "aliases.h" #include "aliases.h"
#include <stdbool.h> #include <stdbool.h>
@ -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_pack_file(buf_t **buf);
void close_asset_pack(asset_pack_t **pack); void close_asset_pack(asset_pack_t **pack);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !PAK_H #endif // !PAK_H

View File

@ -1,8 +1,16 @@
#ifndef PCKR_H #ifndef PCKR_H
#define PCKR_H #define PCKR_H
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "aliases.h" #include "aliases.h"
i32 run_pckr(i32 argc, char *argv[]); i32 run_pckr(i32 argc, char *argv[]);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !PCKR_H #endif // !PCKR_H

View File

@ -1,6 +1,10 @@
#ifndef TEST_UTILS_H #ifndef TEST_UTILS_H
#define TEST_UTILS_H #define TEST_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#define ARRLEN(ARR) (sizeof ARR / sizeof ARR[0]) #define ARRLEN(ARR) (sizeof ARR / sizeof ARR[0])
typedef struct { typedef struct {
@ -8,4 +12,8 @@ typedef struct {
const char *contents; const char *contents;
} asset_t; } asset_t;
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !TEST_UTILS_H #endif // !TEST_UTILS_H