1

I'm using boost.log. Apart from the extreme amount of agro actually getting and building it, it's been running OK on Windows 7 and Vista.

I'm now trying to use the application on Windows XP, but boost.log is blowing with an unhandled exception (Access violaton reading location 0x00000000).

This occurs in the method log:mt_nt5::sources::aux::set_severity_level where it tries to set a static global variable named g_SeverityLevel.

I found a document that suggested building with BOOST_LOG_NO_COMPILER_TLS. I tried this, but it didn't work.

I read further into this, and the problem appears to be around the global variable being declared as __declspec(thread), which makes it thread static. This is only a problem with OSes prior to Vista.

I'm statically linking to boost.log, so I can't figure out why my pre-processor BOOST_LOG_NO_COMPILER_TLS isn't being recognised.

Am I missing something?

Update:

No matter what I do when building the libs with bjam, my BOOST_LOG_NO_COMPILER_TLS flag isn't being recognised. I'm building like this:

bjam address-model=32 --toolset=msvc-10.0 --build-type=complete 
  --with-log variant=debug link=static runtime-link=static   
  define=BOOST_LOG_NO_COMPILER_TLS stage

I compared the contents of the output in the stage folder after building with and without this flag, and the contents are identical!

So, a related question would probably now be: am I using the bjam command line correctly?

Community
  • 1
  • 1
Steve Dunn
  • 21,044
  • 11
  • 62
  • 87

1 Answers1

2

It crashes because it uses thread-static declarations. As described in the articles linked to above, this causes problems in OSes prior to Vista if the DLL containing the logging code is loaded with LoadLibrary (which covers COM components too).

If you have this problem, then recompile the boost.log library, but don't forget to clear out your bin.v2 folder first!

Community
  • 1
  • 1
Steve Dunn
  • 21,044
  • 11
  • 62
  • 87
  • i still have problem. I'm using Boost as shared library on Windows platform suing VC++ 2010. It works as normal exe, but crashes when boost log is used inside windows service. any idea? – Pritesh Acharya Sep 12 '14 at 12:18