Skip to content

Commit 4a0cdca

Browse files
bofh69igrr
authored andcommitted
Export pgmspace symbols to C (#3955)
1 parent cc9e799 commit 4a0cdca

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

cores/esp8266/pgmspace.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <stdarg.h>
2525
#include "pgmspace.h"
2626

27+
extern "C" {
28+
2729
size_t strnlen_P(PGM_P s, size_t size) {
2830
const char* cp;
2931
for (cp = s; size != 0 && pgm_read_byte(cp) != '\0'; cp++, size--);
@@ -286,3 +288,5 @@ int vsnprintf_P(char* str, size_t strSize, PGM_P formatP, va_list ap) {
286288

287289
return ret;
288290
}
291+
292+
} // extern "C"

cores/esp8266/pgmspace.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
#include <stdint.h>
55
#include <stdio.h>
66

7-
#ifdef __ets__
8-
97
#ifdef __cplusplus
108
extern "C" {
119
#endif
10+
11+
#ifdef __ets__
12+
1213
#include "ets_sys.h"
1314
#include "osapi.h"
14-
#ifdef __cplusplus
15-
}
16-
#endif
1715

1816
#define PROGMEM ICACHE_RODATA_ATTR
1917
#define PGM_P const char *
@@ -136,4 +134,8 @@ static inline uint16_t pgm_read_word_inlined(const void* addr) {
136134
#define pgm_read_float_far(addr) pgm_read_float(addr)
137135
#define pgm_read_ptr_far(addr) pgm_read_ptr(addr)
138136

137+
#ifdef __cplusplus
138+
}
139+
#endif
140+
139141
#endif //__PGMSPACE_H_

0 commit comments

Comments
 (0)