views:

307

answers:

1

I ported my application from VC++7 to VC++9 recently. Now it sometimes crashes at exit - the runtime starts calling global objects destructors and an access violation occurs in one of them.

Whenever I observer the call stack the top functions are:

CMyClass::~CMyClass() <- crashes here
dynamic atexit destructor for 'ObjectName'
_CRT_INIT()
some more runtime-related functions follow

The question is what is the meaning of the word "dynamic" in "dynamic atexit destructor"? Can it provide any additional information to me?

+2  A: 

its difficult to pinpoint the exact problem without the actual code, but maybe you can find it yourself after reading this

Alon
Does this imply that "dynamic" is from "dynamic load library"?
sharptooth
No the term refers to the dynamic registration of the atexit function callback during run time, that is as opposed to the static registration done in compile time. it is usefull for dynamic load libraries since your can remove a callback function out of the atexit list if at some arbitrary point your application decides to unload a previously loaded dll, in that case you can also call manually any cleanup code without needing to relay on ateixt.
Alon