[riot-devel] RIOT and static initializers in C++

Ludwig Ortmann ludwig.ortmann at fu-berlin.de
Fri Sep 19 18:09:25 CEST 2014

Hi Raphael,

This might have to do with how native is initialized.
I can try looking into it, but I don't really have much time at the

In case someone with experience in linker scripts is reading this and
wants to help out, speak up!


On Fri, Sep 19, 2014 at 03:15:00PM +0000, Hiesgen, Raphael wrote:
> Hi,
> static initializers don’t seem to work on RIOT. Setting a breakpoint in the constructor reveals, that it is never called. I believe the static initialization should occur before calling main. If I am not mistaken, RIOT calls the function startup before the main.
> I attached an example program [1]. To try it on RIOT, copy the code into the cpp example. If foo is initialized correctly, data should be set to 1. However, the example prints 0.
> Usually the compiler should take care of the initialization. Does someone know why this initialization does not happen on RIOT? 
> Thank you
> Raphael
> [1] https://gist.github.com/josephnoir/c948b78bf586ae4fa361
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> http://lists.riot-os.org/mailman/listinfo/devel

More information about the devel mailing list