Boost C++ Libraries: Ticket #10685: mfc_thread_init.hpp does not compile https://svn.boost.org/trac10/ticket/10685 <pre class="wiki">Visual Studio 2010 (SP1) error C2440: 'initializing' : cannot convert f… …rom 'BOOL (__stdcall *)(HINSTANCE,DWORD,LPVOID)' to 'BOOL (__stdcall *const )(HANDLE,DWORD,LPVOID)' This conversion requires a reinterpret_cast, a C-style cast or function-style cast </pre><p> I have submitted a pull request on github also. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10685 Trac 1.4.3 fab@… Wed, 22 Oct 2014 21:03:32 GMT attachment set https://svn.boost.org/trac10/ticket/10685 https://svn.boost.org/trac10/ticket/10685 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">mfc_thread_init.patch</span> </li> </ul> <p> Patch to address issue </p> Ticket viboes Sat, 25 Oct 2014 15:27:01 GMT description changed https://svn.boost.org/trac10/ticket/10685#comment:1 https://svn.boost.org/trac10/ticket/10685#comment:1 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/10685?action=diff&amp;version=1">diff</a>) </li> </ul> Ticket viboes Sat, 25 Oct 2014 15:38:52 GMT <link>https://svn.boost.org/trac10/ticket/10685#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:2</guid> <description> <p> Could you show the whole compile error? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 25 Oct 2014 15:42:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10685#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:3</guid> <description> <p> Every reference to <a class="missing wiki">ExtRawDllMain</a> (<a class="ext-link" href="https://social.msdn.microsoft.com/Search/en-US?query=ExtRawDllMain&amp;emptyWatermark=true&amp;ac=4"><span class="icon">​</span>https://social.msdn.microsoft.com/Search/en-US?query=ExtRawDllMain&amp;emptyWatermark=true&amp;ac=4</a>) make use of HINSTANCE. </p> <p> Where do you have find a declaration using HANDLE? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 25 Oct 2014 15:42:30 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/10685#comment:4 https://svn.boost.org/trac10/ticket/10685#comment:4 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">Niall Douglas</span> </li> </ul> Ticket fab@… Tue, 28 Oct 2014 00:46:29 GMT <link>https://svn.boost.org/trac10/ticket/10685#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10685#comment:2" title="Comment 2">viboes</a>: </p> <blockquote class="citation"> <p> Could you show the whole compile error? </p> </blockquote> <p> That is the whole compile error on the line that I am changing in the patch. </p> </description> <category>Ticket</category> </item> <item> <author>fab@…</author> <pubDate>Tue, 28 Oct 2014 00:50:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10685#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10685#comment:3" title="Comment 3">viboes</a>: </p> <blockquote class="citation"> <p> Every reference to <a class="missing wiki">ExtRawDllMain</a> make use of HINSTANCE. </p> <p> Where do you have find a declaration using HANDLE? </p> </blockquote> <p> I don't know why the original author of this file used HANDLE -- you are correct in that it should have used HINSTANCE instead just about everywhere. If the "reverse" change is applied, I guess the change could break some folks who started using the HANDLE version which is currently exposed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 28 Oct 2014 06:47:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10685#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:7</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10685#comment:6" title="Comment 6">fab@…</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10685#comment:3" title="Comment 3">viboes</a>: </p> <blockquote class="citation"> <p> Every reference to <a class="missing wiki">ExtRawDllMain</a> make use of HINSTANCE. </p> <p> Where do you have find a declaration using HANDLE? </p> </blockquote> <p> I don't know why the original author of this file used HANDLE -- you are correct in that it should have used HINSTANCE instead just about everywhere. If the "reverse" change is applied, I guess the change could break some folks who started using the HANDLE version which is currently exposed. </p> </blockquote> <p> By the patch is doing the opposite. is changing HINSTANCE by HANDLE. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Niall Douglas</dc:creator> <pubDate>Sat, 01 Nov 2014 16:10:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10685#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:8</guid> <description> <p> <a class="missing wiki">DllMain</a>, or <a class="missing wiki">RawDllMain</a>, takes a HINSTANCE not a HANDLE. Whatever isn't using HINSTANCE needs to do so. </p> <p> We actually have a fairly big problem here, this particular file doesn't get compiled unless the project including the header is using MFC which is surely a minority of users. I'll look into writing a new test case which switches on MFC, that should include this file into being tested from now on. I'll also fix everything up to use HINSTANCE as it should have been from the beginning. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Niall Douglas</dc:creator> <pubDate>Sat, 01 Nov 2014 17:00:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10685#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:9</guid> <description> <p> There is a problem. </p> <p> The following MFC Extension DLL ought to be close to compiling: </p> <pre class="wiki">// Purely to test if Boost.Thread compiles with a MFC extension DLL #ifdef _MSC_VER #include &lt;windows.h&gt; #include &lt;stdafx.h&gt; #include &lt;afxdllx.h&gt; #include &lt;boost/thread.hpp&gt; static AFX_EXTENSION_MODULE extensionDLL; extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) { if (dwReason == DLL_PROCESS_ATTACH) { // Extension DLL one-time initialization if (!AfxInitExtensionModule( extensionDLL, hInstance)) return 0; } else if (dwReason == DLL_PROCESS_DETACH) { // Extension DLL per-process termination AfxTermExtensionModule(extensionDLL); } return 1; // ok } #endif </pre><p> And that would test if Boost.Thread compiles with MFC or not. </p> <p> My problem is I have the Visual Studio Express free edition. I don't have the commercial one costing thousands of euro, so I don't have MFC. </p> <p> Can someone else test this for me please? </p> <p> Thanks, Niall </p> </description> <category>Ticket</category> </item> <item> <author>fab@…</author> <pubDate>Mon, 03 Nov 2014 16:59:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10685#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:10</guid> <description> <p> Guys, </p> <p> Glad this is converging. </p> <p> I have been under a number of deadlines, and I hope to be able to verify the "reverse" patch this week. </p> <p> I will retract my patch in the meantime. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 06 Dec 2014 09:56:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10685#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:11</guid> <description> <p> Any news on this issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 13 Dec 2014 16:07:57 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/10685#comment:12 https://svn.boost.org/trac10/ticket/10685#comment:12 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Support Requests</span> </li> </ul> <p> Moved to support, until there is more feedback. </p> Ticket viboes Sat, 04 Apr 2015 21:43:23 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10685#comment:13 https://svn.boost.org/trac10/ticket/10685#comment:13 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> We need tome tester help in order to be able to fix it. Closed until we get it. </p> Ticket Keith Meadows <Keith.Meadows@…> Fri, 22 Apr 2016 15:44:25 GMT <link>https://svn.boost.org/trac10/ticket/10685#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10685#comment:14</guid> <description> <p> mfc_thread_init.hpp does not compile. This still does not compile when used with MFC. The conflict is pretty obvious here as the function declaration and forward declaration/ assignment do not agree. if line 30 is changed from extern "C" <span class="underline">declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HANDLE, DWORD, LPVOID) = &amp;<a class="missing wiki">ExtRawDllMain</a>; </span></p> <blockquote> <p> to extern "C" <span class="underline">declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HINSTANCE, DWORD, LPVOID) = &amp;<a class="missing wiki">ExtRawDllMain</a>; </span></p> </blockquote> <p> everything compiles and runs as expected. </p> </description> <category>Ticket</category> </item> </channel> </rss>