Alexander Schmitt wrote: > Hello, > > when I use the ECDH<ECP>::Domain class as a member property of a > class an call the contructor in the of ECDH<ECP>::Domain in the > following way: > <snip> > Then there are occuring a application crash, when the object is > defined. In my case the object is defined globally in the > application, so it crashs immediately.
The global definition seems to be the problem. Inside the constructor, this is used: line 286, file algparam.h: if (valueType == g_typeidInteger && typeid(T) == typeid(int)) line 9, file algparam.cpp: const std::type_info &g_typeidInteger = typeid(Integer); This is another global definition. The C++ standard doesn't specify the order in which global definitions are initialised, and in this case the compiler initialises your TestClass tc first. The reference g_typeidInteger is still set to *NULL, and the valueType == g_typeidInteger crashes. The workaround is: put your TestClass tc inside main(). Another option is to change if (valueType == g_typeidInteger && typeid(T) == typeid(int)) to if (valueType == typeid(Integer) && typeid(T) == typeid(int)) inside algparam.h Best regards, Richard Peters
