arduino/Arduino — pull request #2229 by Chris--A (2014-08-04 11:31:41+00:00)
Title: Patch 3

Hi, I recently ran into an issue which is present in all branches of the IDE.

The linker fails due to a missing standard library function `atexit()`.
This issue affects all IDE branches I have tested:
- **1.0.5-r2**
- **1.5.6-r2**
- **1.5.7** using C++11

The problem manifests itself when giving an object with a defined destructor, _static local_ storage duration.

Here are two basic examples of the error:
```C++
void setup(){
static String s;
}

void loop() {}
```

Its not the String libraries fault, any object that requires implicit destruction causes an error:
```C++
struct Foo{
Foo(){}
~Foo(){}
};

void setup(){
static Foo f;
}

void loop() {}
```

The fix I propose will allow these examples to compile, and I have tested it on the three versions of the IDE I mentioned above.

I created this patch on the master, can you automatically merge this with 1.5.x, or do I need to make a new pull request?

Also, my proposed patch will resolve the issue opened here #1919.

As a side note, if the function is moved else where, it must be declared `extern "C"`. This is taken care of by Arduino.h