Skip to content

The pgmspace symbols are now exported to C #3955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cores/esp8266/pgmspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <stdarg.h>
#include "pgmspace.h"

extern "C" {

size_t strnlen_P(PGM_P s, size_t size) {
const char* cp;
for (cp = s; size != 0 && pgm_read_byte(cp) != '\0'; cp++, size--);
Expand Down Expand Up @@ -286,3 +288,5 @@ int vsnprintf_P(char* str, size_t strSize, PGM_P formatP, va_list ap) {

return ret;
}

} // extern "C"
12 changes: 7 additions & 5 deletions cores/esp8266/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
#include <stdint.h>
#include <stdio.h>

#ifdef __ets__

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __ets__

#include "ets_sys.h"
#include "osapi.h"
#ifdef __cplusplus
}
#endif

#define PROGMEM ICACHE_RODATA_ATTR
#define PGM_P const char *
Expand Down Expand Up @@ -136,4 +134,8 @@ static inline uint16_t pgm_read_word_inlined(const void* addr) {
#define pgm_read_float_far(addr) pgm_read_float(addr)
#define pgm_read_ptr_far(addr) pgm_read_ptr(addr)

#ifdef __cplusplus
}
#endif

#endif //__PGMSPACE_H_