Boost logo

Boost Users :

From: Séverin Lemaignan (severin.lemaignan_at_[hidden])
Date: 2006-12-13 04:13:18


Hello,

I'm Severin Lemaignan, software engineer at the INRIA french public
research center. We are working on automation in public transportation.
All our project is currently a pretty big C++/CLI-based piece of software,
and we are relying more and more on Boost for low-level operations like
threading.

We ran very recently into a problem with Boost mutexes:

We compile the project with Visual Studio 2005 (with the /clr flag), and
everything was fine until we (re-)enabled precompiled headers.

After that, the program still compiled and linked but it crashed as soon
as started with a 0xc000007b error (namely "The application failed to
initialize properly").

After futher investigation, we discovered it's due to the way we use
"#pragma unmanaged" and "#pragma managed". The Boost headers were simply
included in a "managed" part of the code while Boost methods (especially
mutexes) were called in a "unmanaged" part. Hence causing the crash.

The Boost library never complained at compile time. Maybe it should
detect inconsistent use of managed/unmanaged pragma and warn the user ?

We found another pratical (but unexpected) solution to the issue:
instanciate a Boost::thread before the mutex. It solved the run-time
crash. If someone has an explaination...

Best regards,

Séverin Lemaignan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net