I have some code that uses boost::locale::date_time. For this to work I need to initialize a locale in my main function as described here:

http://www.boost.org/doc/libs/master/libs/locale/doc/html/faq.html

Now I want to put my code into a Windows DLL and create the locale in the DLL initialization. I want to load the DLL dynamically with LoadLibrary/GetProcAddress.
The problem is, the single line

boost::locale::generator gen;

is enough to make LoadLibrary fail with error ERROR_NOACCESS (998) on Windows XP. This does not happen on Windows 7/8 !! From what I could find out the error means that an exception in the DLL initialization code happened. When I remove the above line, the error is gone.

I compiled the DLL with Visual Studio 2015 and the Platform Toolset option set to:
Visual Studio 2015 - Windows XP (v140_xp)
My boost version is 1.58

Any idea what could be wrong with locale generation on Windows XP in a DLL?

(I know XP is out of support, still we have some running systems for some more years in private networks that I would like to support)

Thanks for any idea!

 

Last edit: Nicolas Reinschmidt 2015-07-07