Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding #include <boost/thread/mutex.hpp> breaks my ActiveX control?

Is there a known problem with the boost::mutex header when used inside an ActiveX control?
(Boost version v1.39)

If I create an MFC ActiveX Control project in Visual Studio 2008 called "DefaultOCXControl" then I can build it, the control registers itself as part of the build, and can be inserted into the ActiveX Test Container as you would expect. All good.

If I then just add this line:

#include <boost/thread/mutex.hpp>

at the top of my DefaultOCXControlCtrl.h file and rebuild: the registration step at the end of the build fails with:

Debug Assertion Failed!
Program: C:\Windows\system32\regsvr32.exe
File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dllinit.cpp
Line: 587

The offending assertion looks like this:

void AFXAPI AfxCoreInitModule()
{
    ASSERT(AfxGetModuleState() != AfxGetAppModuleState());
    ...

Attempting to insert the control into the ActiveX Test Container now results in the same message. If I remove the line and rebuild then everything is fine - so it definitely seems to be something in that header file that causes the issue.

like image 763
GrahamS Avatar asked Mar 18 '11 17:03

GrahamS


People also ask

What is a word for adding?

1 affix, append, attach, adjoin. 2 total, sum.

What type of word is adding?

As detailed above, 'adding' is a verb.

What is add up in math?

Addition is a way of combining things and counting them together as one large group. Addition in math is a process of combining two or more numbers. Addends are the numbers added, and the result or the final answer we get after the process is called the sum.

Where do we use added?

You use added to say that something has more of a particular thing or quality.


1 Answers

Have you tried linking boost::thread dynamically (define BOOST_THREAD_DYN_LINK)?

I had this kind of problems when using boost::thread with a mixed C++/.NET project and linking just boost::thread dynamically was the solution (here a possible explanation: http://article.gmane.org/gmane.comp.lib.boost.user/22617/match=clr)

like image 72
Paolo Brandoli Avatar answered Sep 27 '22 00:09

Paolo Brandoli