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
This commit is contained in:
Christopher Andrews 2014-08-04 21:03:32 +10:00 committed by Cristian Maglie
parent b06b62d2f7
commit 28acfd7d9d
2 changed files with 5 additions and 0 deletions

View File

@ -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);

View File

@ -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));