NodeJS Addon Unordered_map not supported?

I am working with the Laurena library for C++ to add serialization to JSON to my Node Addon. When I initialize the library, it gets to a particular point in the code where it defines two unordered_map objects. They aren't initialized, but instead immediately used (as in the code below). ANY access to any data or any methods within the unordered_maps causes a vector subscript out of range failure.

But ONLY in nodejs.

If I pull the addon code and dump it into a Visual Studio 2013 C++ Console application, without ANY changes, it runs perfectly. Can anyone point me in the direction of what it is about these unodered_maps that isn't supported in node that is in a regular console app?

using namespace laurena;

std::unordered_map<std::string, const descriptor*>      classes::_classes_by_name;
std::unordered_map<size_t, const descriptor*>           classes::_classes_by_typeid;

void classes::add(const descriptor* myClass)
{
   for(int i = 0; i< _classes_by_typeid.size(); i++)
   {
       printf("in array I (%d) : %Iu", i, _classes_by_typeid[i]); //FAILS!
   }

    // also failes
    printf("Access ANYTHING? %s \n", _classes_by_typeid.hash_function());


   // Doesn't fail? WTF??
   printf("Post Set array size :: %d\n", _classes_by_name.size());
   printf("Post Set array size :: %d\n", _classes_by_typeid.size());
}

I'm Laurena's author.

Laurena's library in this current version has a big flaw as it use global static variables to store classes descriptors. A better implementation would have been to store them into a singleton initialized dynamically.

A possible explain is you call laurena::classes::add from another library's static member/global data constructor. Static / global datas constructors are executed before int main (...)

In this case, if your data's constructor is called before laurena's static maps constructors, then yes you can have the error you describe. See What’s the “static initialization order fiasco”? at https://isocpp.org/wiki/faq/ctors#static-init-order for more details about this problem.

Then there is two options:

1) laurena::classes static datas must be wrapped into a singleton dynamically created. laurena::classes::add method should looks then

void classes::add(const descriptor* myClass) // classes::add is a static class function
{
    classes* p = classes::get_or_create_instance ();
    p->_classes_by_name[myClass->name()] = myClass;
    p->_classes_by_typeid[std::type_index(myClass->type()).hash_code()] = myClass;

}

2) Move calls to classes::add into int main ( ... ) :

int main ()
{

    // laurena's initialization
    laurena::classes::init();

    // let's declare TheNerd serializables classes :
    declare_TheNerd_classes();

   ...
}

If you can't use option 2, option 1 is something i could fix.