
I've had real trouble isolating a minimal set of code to reproduce this. It appears to be related to the static local instance:
__PURE_APPDOMAIN_GLOBAL static std::locale::_Locimp *global_locale = 0; // pointer to current locale
being deleted once for *each loaded DLL*. When I Release() a COM component in a separate DLL, the DLL is unloaded and calls tidy_global() deleting global_locale. Later the EXE terminates which again tries to delete global_locale causing an access violation.
Unfortunately, I'm nowhere near a small set of code for repro yet :(
Ok, I see, this enteres the area called COM+DLLs... where I feel quite... helpless. I really have no idea why this does not work and why something destroyed twice, because it shouldn't. But it looks like rather issue reated to runtime environment rather then to specific localization library. You probably may try to test something like that (create a facet of your own); class my_facet: std::locale::facet { public: my_facet() : std::locale::facet(0) { } std::locale::id id; }; std::locale::id my_facet::id; struct init { init() { std::locale tmp(std::locale::classic(),new my_facet); std::locale::global(tmp); }} instance; Maybe do some allocations, deallocations in it and see if it causes crash (without any usage of boost::locale), if it causes crash then it has nothing to do to library but rather to environment. -------------------------------- For unit test you may try to do something like that: void set_locale() { if(std::has_facet<boost::locale::info>(std::locale()) return; boost::locale::generator gen(); ... /// set path you need ... std::locale::global(gen("en_US.UTF-8")); } And before each test just call set_locale. It would check that `boost::locale` based locale was loaded (every such locale has boost::locale::info facet) and not reload dictionaries each time.
P.S. As you advised, I compiled my own version of ICU. Because they only ship an MSVC9 project with version 4.2 (why do projects to that?!) I've downgraded to 4.0.
Strange, because according to their documentation MSVC 2005 is supported. Artyom