|
Boost Users : |
Subject: Re: [Boost-users] issue about include boost thread header in MFC dll
From: Pravar (pravar.jawalkar_at_[hidden])
Date: 2012-06-22 00:44:07
On 06/22/2012 07:45 AM, young wrote:
> I have a MFC dll application. I try to use Boost thread in the dll.
>
> #include "stdafx.h"
> #include "interface.h"
> #include "MFCDLL.h"
>
> #include<boost/thread.hpp>
>
> // The one and only CMFCDLLApp object
> CMFCDLLApp theApp;
>
> EXPORT32 int __stdcall func()
> {
> AFX_MANAGE_STATE(AfxGetStaticModuleState());
> ...
> return DLL_OK;
> }
>
> The build is OK. But when I call the func, it crashes. If I comment the
> line:
> //#include<boost/thread.hpp>
>
> Then it works well. So how to use thread in MFC dll?
Providing exact errors here would be more helpful in reasoning about the
problem.
Anyway, Most common cause of this problem could be that you are not
linking your program with boost thread library ( i.e. libboost_thread-mt.a).
It could result in errors saying "Undefined Symbols".
If you have indeed linked boost thread library with your program then
another reason for errors could be that you have used different link
flags. I mean that you may have missed "/MT" flag while compiling your
program.
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/issue-about-include-boost-thread-header-in-MFC-dll-tp4631663.html
> Sent from the Boost - Users mailing list archive at Nabble.com.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and
intended
for the named recipient(s) only.
It shall not attach any liability on the originator or NECHCL or its
affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of NECHCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. .
-----------------------------------------------------------------------------------------------------------------------
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