Skip to content

Commit b6f0139

Browse files
committed
zephyr: Fix more C++ linkage
1 parent d98bbf1 commit b6f0139

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

wolfssl/wolfcrypt/settings.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,6 +2594,10 @@ extern void uITRON4_free(void *p) ;
25942594
#endif /*(WOLFSSL_APACHE_MYNEWT)*/
25952595

25962596
#ifdef WOLFSSL_ZEPHYR
2597+
#ifdef __cplusplus
2598+
} /* extern "C" */
2599+
#endif
2600+
25972601
#include <version.h>
25982602
#if KERNEL_VERSION_NUMBER >= 0x30100
25992603
#include <zephyr/kernel.h>
@@ -2606,6 +2610,10 @@ extern void uITRON4_free(void *p) ;
26062610
#endif
26072611
#include <stdlib.h>
26082612

2613+
#ifdef __cplusplus
2614+
extern "C" {
2615+
#endif
2616+
26092617
#define WOLFSSL_DH_CONST
26102618
#define NO_WRITEV
26112619
#define NO_STDLIB_ISASCII

wolfssl/wolfcrypt/wc_port.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@
283283
#elif defined(WOLFSSL_APACHE_MYNEWT)
284284
/* do nothing */
285285
#elif defined(WOLFSSL_ZEPHYR)
286-
/* Zephyr SDK can use a cpp compiler which will cause
287-
* problems with extern "C" linkage if not handled */
288286
#ifdef __cplusplus
289287
} /* extern "C" */
290288
#endif
@@ -994,8 +992,16 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
994992
#define XFGETS(b,s,f) -2 /* Not ported yet */
995993

996994
#elif defined(WOLFSSL_ZEPHYR)
995+
#ifdef __cplusplus
996+
} /* extern "C" */
997+
#endif
998+
997999
#include <zephyr/fs/fs.h>
9981000

1001+
#ifdef __cplusplus
1002+
extern "C" {
1003+
#endif
1004+
9991005
#define XFILE struct fs_file_t*
10001006

10011007
/* These are our wrappers for opening and closing files to
@@ -1481,6 +1487,10 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
14811487
#define USE_WOLF_TIME_T
14821488

14831489
#elif defined(WOLFSSL_ZEPHYR)
1490+
#ifdef __cplusplus
1491+
} /* extern "C" */
1492+
#endif
1493+
14841494
#include <version.h>
14851495
#ifndef _POSIX_C_SOURCE
14861496
#if KERNEL_VERSION_NUMBER >= 0x30100
@@ -1500,6 +1510,10 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
15001510
#endif
15011511
#endif
15021512

1513+
#ifdef __cplusplus
1514+
extern "C" {
1515+
#endif
1516+
15031517
time_t z_time(time_t *timer);
15041518

15051519
#define XTIME(tl) z_time((tl))

wolfssl/wolfio.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@
176176
#include <lwip-socket.h>
177177
#include <errno.h>
178178
#elif defined(WOLFSSL_ZEPHYR)
179+
#ifdef __cplusplus
180+
} /* extern "C" */
181+
#endif
182+
179183
#include <version.h>
180184
#if KERNEL_VERSION_NUMBER >= 0x30100
181185
#include <zephyr/net/socket.h>
@@ -188,6 +192,10 @@
188192
#include <posix/sys/socket.h>
189193
#endif
190194
#endif
195+
196+
#ifdef __cplusplus
197+
extern "C" {
198+
#endif
191199
#elif defined(MICROCHIP_PIC32)
192200
#include <sys/errno.h>
193201
#elif defined(HAVE_NETX)

0 commit comments

Comments
 (0)