On 24/05/2023 20:38, M L wrote:
std::locale = generator(lngCode + ".WINDOWS-1252"); // this line crashes
-> 0x0000005 EnterCriticalSection Boost Version: (boost_1_60_0) Visual Studio 2013
I'm assuming that's a typo and you meant 0xC000005, which is an access violation. Typically this means that something wasn't initialized properly. Boost 1.60 is ancient history; you should consider upgrading.
- the problem is project dependent. Same code works in a different project. - the problem only appears if a specific header is included, but nothing in this header is ever executed before the crash. Removing the header/cpp removes the problem. - some C code is present in the code - the problem even appears when moving the snipped in main.
Since you've narrowed the trigger down to a particular header, you can try narrowing it further by commenting in/out things in that header. Or post a full compilable MCVE if you want help. But the most likely problem is that you have an ODR violation -- some of your code is being compiled with different settings than others, which causes incompatible compiler output. The most common culprit for this sort of thing is incompatible #pragma pack or #define settings, but there are other possibilities. In particular you should not include external headers under the influence of a non-default pack setting (whether via #pragma or project/file settings) -- if you must use a different value then keep it to as narrow a scope as possible.