aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorChristopher Andrews <chris@arduino.land>2014-08-04 21:03:32 +1000
committerCristian Maglie <c.maglie@bug.st>2014-08-08 15:38:57 +0200
commit28acfd7d9d59b37f0b1deef25be999d281c1231b (patch)
tree8d7928705b7fa6e065dad56183beb2604fd9aec7 /cores/arduino
parentb06b62d2f73a56da01a14ff3c445c1363e9162e9 (diff)
Added replacement stub for cstdlib atexit() funciton.
This is an empty stub to simply allow use of complex types with a non global static lifetime. For more complex handling the function 'atexit' can be redefined in user code. For more information see: https://github.com/arduino/Arduino/pull/2229 https://github.com/arduino/Arduino/issues/1919
Diffstat (limited to 'cores/arduino')
-rwxr-xr-xcores/arduino/Arduino.h2
-rw-r--r--cores/arduino/main.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h
index 425dfcb..8673ab8 100755
--- a/cores/arduino/Arduino.h
+++ b/cores/arduino/Arduino.h
@@ -115,6 +115,8 @@ typedef uint8_t byte;
void init(void);
void initVariant(void);
+int atexit(void (*func)()) __attribute__((weak));
+
void pinMode(uint8_t, uint8_t);
void digitalWrite(uint8_t, uint8_t);
int digitalRead(uint8_t);
diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp
index 091c365..a60980d 100644
--- a/cores/arduino/main.cpp
+++ b/cores/arduino/main.cpp
@@ -19,6 +19,9 @@
#include <Arduino.h>
+//Declared weak in Arduino.h to allow user redefinitions.
+int atexit(void (*func)()) { return 0; }
+
// Weak empty variant initialization function.
// May be redefined by variant files.
void initVariant() __attribute__((weak));