lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 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!