Skip to content

Commit 24ada92

Browse files
committed
Similar to antirez#19 and other Issues listed in antirez/gguf-tools, facilitate compilation in C++ with the addition of some basic ifdefs.
Tested working.
1 parent 048ebda commit 24ada92

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

fp16.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
#ifndef FP16_h
44
#define FP16_h
5+
#ifdef __cplusplus
6+
extern "C" {
7+
#endif
58
float from_half(uint16_t h);
69
uint16_t to_half(float f);
10+
#ifdef __cplusplus
11+
}
12+
#endif // __cplusplus
713
#endif

gguflib.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ typedef struct {
174174

175175
/* =============================== Prototypes =============================== */
176176

177+
#ifdef __cplusplus
178+
extern "C" {
179+
#endif
180+
177181
gguf_ctx *gguf_open(const char *filename);
178182
gguf_ctx *gguf_create(const char *filename, int flags);
179183
int gguf_remap(gguf_ctx *ctx);
@@ -198,4 +202,8 @@ float *gguf_tensor_to_float(gguf_tensor *tensor);
198202
int16_t *gguf_tensor_to_f16(gguf_tensor *tensor);
199203
int16_t *gguf_tensor_to_bf16(gguf_tensor *tensor);
200204

205+
#ifdef __cplusplus
206+
}
207+
#endif
208+
201209
#endif

0 commit comments

Comments
 (0)