On 15/04/2021 07:55, Alex Peshkoff via Firebird-devel wrote: >> >> It uses global std objects which in this case have theirs destructors >> called after Firebird default pool are already cleaned up. > > Yes, that's really a problem. And must say that even forgetting about > MemPool implementation details I hardly understand how is it supposed to > work with redefined new / delete. One can have global objects in a unit, > implementing new and delete, but Ido not know how does standard suppose > to have working new/delete before constructors and after destructors of > that objects are executed. >
Could you give more details of what you mean? >> >> I have tested with common/classes/init.cpp and this solved the specific >> problem I had with Boost.Test: >> >> Cleanup global __attribute__ ((init_priority (2000))); > > As far as I can see from documentation init_priority works only inside > simgle file. It might affect global order as side effect but (correct me > if I'm wrong) nobody guarantees cross-file order of ctors (and dtors - > actually we care about it). > As I said, documentation is very brief (bad) and I had the same doubts. But tested with clang, it works across translation units. I had defined objects with init_priority 5000, 5500 and 5400 (in this order) in two different .cpp files (one in common library, another in yvalve specific code). Order of construction was: 5000 (yvalve) 5000 (common) 5400 (yvalve) 5400 (common) 5500 (yvalve) 5500 (common) What seems undefined here seems only yvalve/common order of same priority. Adriano Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel