[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: C++ and static deallocators in Lua cause crash
- From: "Wim Couwenberg" <wim.couwenberg@...>
- Date: Sun, 30 Dec 2007 15:43:24 +0100
Hi,
> I wasn't
> able to find any good references on the order of static destructors.
> Do you happen to have any?
The ISO standard. :-) You can find drafts online. It is also in
Stroustrup. (He discusses the global streams cout, cin, cerr in this
respect too.)
> My guess is that the destructors are being
> called in reverse order.
Correct, but this rule holds only within a single compilation unit.
(Constructors are called top-to-bottom, destructors bottom-to-top.)
There is no rule for the order of construction/destruction between
different compilation units.
> I can however grab notifications from Cocoa about
> various states in the app closing procedure to close down Lua before
> any static destructors are called.
That is certainly the preferred way to go. Good luck!
--
Wim