Common source code (ESP-IDF vs Linux)
Posted: Fri Jun 01, 2018 10:19 am
Hello,
In my project I write C++ classes which are 99% identical (at source level) for both linux (RPi) and ESP-IDF. Only minor differences exists, for example ESP_LOGx(...) vs syslog(...).
I'm looking for compile time defines identifying the different compilers, so that this pseudo-code works:
Thanks in advance,
Paul.
In my project I write C++ classes which are 99% identical (at source level) for both linux (RPi) and ESP-IDF. Only minor differences exists, for example ESP_LOGx(...) vs syslog(...).
I'm looking for compile time defines identifying the different compilers, so that this pseudo-code works:
Code: Select all
#ifdef RPi
#define LOG(...) syslog(...)
#elif defined ESP_IDF
#define LOG(...) ESP_LOGI(...)
#else
#error "Incompatible code..."
#endif
Paul.