Skip to content

Commit 440dbbb

Browse files
committed
Add extern "C" guards to public headers
1 parent 1d9046f commit 440dbbb

File tree

11 files changed

+88
-0
lines changed

11 files changed

+88
-0
lines changed

include/libimobiledevice-glue/cbuf.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@ struct char_buf {
3030
unsigned int capacity;
3131
};
3232

33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
3337
LIMD_GLUE_API struct char_buf* char_buf_new();
3438
LIMD_GLUE_API void char_buf_free(struct char_buf* cbuf);
3539
LIMD_GLUE_API void char_buf_append(struct char_buf* cbuf, unsigned int length, unsigned char* data);
3640

41+
#ifdef __cplusplus
42+
}
43+
#endif
44+
3745
#endif /* __CBUF_H */

include/libimobiledevice-glue/collection.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ struct collection {
2929
int capacity;
3030
};
3131

32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
3236
LIMD_GLUE_API void collection_init(struct collection *col);
3337
LIMD_GLUE_API void collection_add(struct collection *col, void *element);
3438
LIMD_GLUE_API int collection_remove(struct collection *col, void *element);
@@ -51,4 +55,8 @@ LIMD_GLUE_API void collection_copy(struct collection *dest, struct collection *s
5155
} \
5256
} while(0);
5357

58+
#ifdef __cplusplus
59+
}
60+
#endif
61+
5462
#endif

include/libimobiledevice-glue/glue.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
#endif
3333
#endif
3434

35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
3539
LIMD_GLUE_API const char* libimobiledevice_glue_version();
3640

41+
#ifdef __cplusplus
42+
}
43+
#endif
44+
3745
#endif

include/libimobiledevice-glue/nskeyedarchive.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ enum nskeyedarchive_class_type_t {
5050

5151
typedef struct nskeyedarchive_st *nskeyedarchive_t;
5252

53+
#ifdef __cplusplus
54+
extern "C" {
55+
#endif
56+
5357
LIMD_GLUE_API nskeyedarchive_t nskeyedarchive_new(void);
5458
LIMD_GLUE_API nskeyedarchive_t nskeyedarchive_new_from_plist(plist_t plist);
5559
LIMD_GLUE_API nskeyedarchive_t nskeyedarchive_new_from_data(const void* data, uint32_t size);
@@ -87,4 +91,8 @@ LIMD_GLUE_API int nskeyedarchive_get_class_property(nskeyedarchive_t ka, uint64_
8791

8892
LIMD_GLUE_API plist_t nskeyedarchive_to_plist(nskeyedarchive_t ka);
8993

94+
#ifdef __cplusplus
95+
}
96+
#endif
97+
9098
#endif

include/libimobiledevice-glue/opack.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
#include <libimobiledevice-glue/glue.h>
2525
#include <plist/plist.h>
2626

27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
2731
LIMD_GLUE_API void opack_encode_from_plist(plist_t plist, unsigned char** out, unsigned int* out_len);
2832
LIMD_GLUE_API int opack_decode_to_plist(unsigned char* buf, unsigned int buf_len, plist_t* plist_out);
2933

34+
#ifdef __cplusplus
35+
}
36+
#endif
37+
3038
#endif /* __OPACK_H */

include/libimobiledevice-glue/sha.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
#include <libimobiledevice-glue/glue.h>
88

9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
913
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
1014
*
1115
* LibTomCrypt is a library that provides various cryptographic
@@ -83,4 +87,8 @@ LIMD_GLUE_API int sha384_final(sha384_context * md, unsigned char *out);
8387
LIMD_GLUE_API int sha384_update(sha384_context * md, const void *data, size_t inlen);
8488
LIMD_GLUE_API int sha384(const unsigned char *message, size_t message_len, unsigned char *out);
8589

90+
#ifdef __cplusplus
91+
}
92+
#endif
93+
8694
#endif

include/libimobiledevice-glue/socket.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ typedef enum fd_mode fd_mode;
4343

4444
#include <libimobiledevice-glue/glue.h>
4545

46+
#ifdef __cplusplus
47+
extern "C" {
48+
#endif
49+
4650
#ifndef _WIN32
4751
LIMD_GLUE_API int socket_create_unix(const char *filename);
4852
LIMD_GLUE_API int socket_connect_unix(const char *filename);
@@ -69,4 +73,8 @@ LIMD_GLUE_API const char *socket_addr_to_string(struct sockaddr *addr, char *add
6973

7074
LIMD_GLUE_API int get_primary_mac_address(unsigned char mac_addr_buf[6]);
7175

76+
#ifdef __cplusplus
77+
}
78+
#endif
79+
7280
#endif /* SOCKET_SOCKET_H */

include/libimobiledevice-glue/termcolors.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
#define BG_WHITE "\e[107m"
7575
#define BG_DEFAULT "\e[49m"
7676

77+
#ifdef __cplusplus
78+
extern "C" {
79+
#endif
80+
7781
/* automatically called by library constructor */
7882
LIMD_GLUE_API void term_colors_init();
7983

@@ -85,4 +89,8 @@ LIMD_GLUE_API int cprintf(const char* fmt, ...);
8589
LIMD_GLUE_API int cfprintf(FILE* stream, const char* fmt, ...);
8690
LIMD_GLUE_API int cvfprintf(FILE* stream, const char* fmt, va_list vargs);
8791

92+
#ifdef __cplusplus
93+
}
94+
#endif
95+
8896
#endif

include/libimobiledevice-glue/thread.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ typedef pthread_once_t thread_once_t;
6666
#define THREAD_T_NULL (THREAD_T)NULL
6767
#endif
6868

69+
#ifdef __cplusplus
70+
extern "C" {
71+
#endif
72+
6973
typedef void* (*thread_func_t)(void* data);
7074

7175
LIMD_GLUE_API int thread_new(THREAD_T* thread, thread_func_t thread_func, void* data);
@@ -99,4 +103,8 @@ LIMD_GLUE_API int cond_signal(cond_t* cond);
99103
LIMD_GLUE_API int cond_wait(cond_t* cond, mutex_t* mutex);
100104
LIMD_GLUE_API int cond_wait_timeout(cond_t* cond, mutex_t* mutex, unsigned int timeout_ms);
101105

106+
#ifdef __cplusplus
107+
}
108+
#endif
109+
102110
#endif

include/libimobiledevice-glue/tlv.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ struct tlv_buf {
3131
};
3232
typedef struct tlv_buf* tlv_buf_t;
3333

34+
#ifdef __cplusplus
35+
extern "C" {
36+
#endif
37+
3438
LIMD_GLUE_API tlv_buf_t tlv_buf_new();
3539
LIMD_GLUE_API void tlv_buf_free(tlv_buf_t tlv);
3640

@@ -40,4 +44,8 @@ LIMD_GLUE_API int tlv_data_get_uint(const void* tlv_data, unsigned int tlv_lengt
4044
LIMD_GLUE_API int tlv_data_get_uint8(const void* tlv_data, unsigned int tlv_length, uint8_t tag, uint8_t* value);
4145
LIMD_GLUE_API int tlv_data_copy_data(const void* tlv_data, unsigned int tlv_length, uint8_t tag, void** out, unsigned int* out_len);
4246

47+
#ifdef __cplusplus
48+
}
49+
#endif
50+
4351
#endif /* __TLV_H */

0 commit comments

Comments
 (0)