Subj : Re: Can you mimic atexit() for class functions? To : borland.public.cpp.borlandcpp From : "Ed Mulroy [TeamB]" Date : Wed Oct 08 2003 10:33 am Yes there is an order. Class instances which are declared globally will have their destructor called at the end of the program. Class instances which are allocated at runtime with new will have their destructor called when delete is called for them. Class instances declared as local variables within a function will have their destructor called when the function returns. Class instances returned as temporary instances from a function will have their destructor called after the calling line is finished. So if you declare a global instance of a class then its destructor will be called when the program ends. This has nothing to do with when a DLL would be unloaded. That is a different subject. .. Ed > Jeff Kish wrote in message > news:6928ovsifnp973naqmk2l9k18jdfmnlf9n@4ax.com... > > Hey, don't forget, I don't thinkg there is any guarantee as far as the > order of creation/destruction goes for static/global objects. > I'm right, aren't I? Also the order of dlls and how they get shut down > is unpredictable also, isn't it? I think this makes final cleanup > painful sometimes. > I appreciate any clarification/tutorial/"you ought to know better" > type information here. .