Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature/arduino compatibility regression #1283
Attempts to restore 0.6.0-style arduino compatibility as outlined by issue #1278
In a nutshell:
Mixing libraries that require partial and full Arduino compatibility
Libraries that require full Arduino compatibility may include Arduino.h in their library header file, while libraries that depend on partial compatibility (because they themselves define missing symbols) don't include Arduino.h. If a library requiring partial compatibility is included after one requiring full compatibility then the partial compatibility library may break, since Arduino symbols that it's not expecting will be defined.
The workaround for this is to include all libraries requiring partial compatibility before libraries requiring full compatibility in the application file.
ENHANCEMENT / BUG FIX
technobly left a comment
should this be
Did you check what happens when multiple include files are included? Are the Arduino symbols defined "as expected"?
It can get hairy with symbol redefinitions in libraries so it would be fine if some cases don't work, but it would be nice if the easy case (both Arduino.h and Particle.h included, libraries don't redefine Arduino symbols) works.
Apr 3, 2017
Once the arduino header is included, the symbols remain visible until the end of the compilation unit (and for all subsequent headers.)
For example, in this case
The second library is not expecting the arduino symbols to be defined (e.g. it might declare it's own copy of
In the example above, reversing the order of the headers would fix the problem.