<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div class="gmail_quote"><br><div dir="ltr"><div>Hi,</div><div><br></div><div>I have a C++ DLL which has exported functions which is used in a C# application�via DllImport. The C++ DLL is linked to various .lib files which use boost�functionality�(thread, asio etc) internally and are compiled with BOOST_ALL_DYN_LINK option to work with C++\CLI</div>

<div><br></div><div>When I run the application it just hangs with following stack trace. I get the same results if I convert this to a C++\CLI DLL and use it directly from the C# application.</div><div><div></div><div class="h5">
<div><br></div><div>
Stack Trace:</div><div>------------------------------------------------</div><div>OneComShim.dll!boost::asio::detail::win_thread::start_thread(boost::asio::detail</div><div>::win_thread::func_base * arg=0x035574f0, unsigned int stack_size=0x00010000) �</div>


<div>Line 98 + 0xe bytes<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::detail::win_thread::win_thread&lt;boost::asio::detail::</div><div>win_iocp_io_service::timer_thread_function&gt;</div>


<div>(boost::asio::detail::win_iocp_io_service::timer_thread_function f={...},�</div><div>unsigned int stack_size=0x00010000) �Line 72<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::detail::win_iocp_io_service::do_add_timer_queue(boos</div>


<div>t::asio::detail::timer_queue_base &amp; queue={...}) �Line 471 + 0x31 bytes<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::detail::win_iocp_io_service::add_timer_queue&lt;boost::</div>


<div>asio::time_traits&lt;boost::posix_time::ptime&gt; &gt;</div><div>(boost::asio::detail::timer_queue&lt;boost::asio::time_traits&lt;boost::posix_time::pt</div><div>ime&gt; &gt; &amp; queue={...}) �Line 78<span style="white-space:pre-wrap">	</span>C++</div>


<div>OneComShim.dll!boost::asio::detail::deadline_timer_service&lt;boost::asio::time_tra</div><div>its&lt;boost::posix_time::ptime&gt;�</div><div>&gt;::deadline_timer_service&lt;boost::asio::time_traits&lt;boost::posix_time::ptime&gt; &gt;</div>


<div>(boost::asio::io_service &amp; io_service={...}) �Line 68<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::deadline_timer_service&lt;boost::posix_time::ptime,boos</div>
<div>t::asio::time_traits&lt;boost::posix_time::ptime&gt;�</div><div>&gt;::deadline_timer_service&lt;boost::posix_time::ptime,boost::asio::time_traits&lt;boos</div><div>t::posix_time::ptime&gt; &gt;(boost::asio::io_service &amp; io_service={...}) �Line 73<span style="white-space:pre-wrap">	</span></div>


<div>C++</div><div>OneComShim.dll!boost::asio::detail::service_registry::create&lt;boost::asio::deadli</div><div>ne_timer_service&lt;boost::posix_time::ptime,boost::asio::time_traits&lt;boost::posix_</div><div>time::ptime&gt; &gt; &gt;(boost::asio::io_service &amp; owner={...}) �Line 81 + 0x2f bytes<span style="white-space:pre-wrap">	</span></div>


<div>C++</div><div>OneComShim.dll!boost::asio::detail::service_registry::do_use_service(const�</div><div>boost::asio::io_service::service::key &amp; key={...},�</div><div>boost::asio::io_service::service * (boost::asio::io_service &amp;)*�</div>


<div>factory=0x100c770d) �Line 123 + 0xc bytes<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::detail::service_registry::use_service&lt;boost::asio::d</div><div>eadline_timer_service&lt;boost::posix_time::ptime,boost::asio::time_traits&lt;boost::p</div>


<div>osix_time::ptime&gt; &gt; &gt;() �Line 49<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::use_service&lt;boost::asio::deadline_timer_service&lt;boos</div><div>t::posix_time::ptime,boost::asio::time_traits&lt;boost::posix_time::ptime&gt; &gt; &gt;</div>


<div>(boost::asio::io_service &amp; ios={...}) �Line 34<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::basic_io_object&lt;boost::asio::deadline_timer_service&lt;</div>
<div>boost::posix_time::ptime,boost::asio::time_traits&lt;boost::posix_time::ptime&gt; &gt;�</div><div>&gt;::basic_io_object&lt;boost::asio::deadline_timer_service&lt;boost::posix_time::ptime,</div><div>boost::asio::time_traits&lt;boost::posix_time::ptime&gt; &gt; &gt;(boost::asio::io_service &amp;�</div>


<div>io_service={...}) �Line 91 + 0x4b bytes<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!boost::asio::basic_deadline_timer&lt;boost::posix_time::ptime,boost:</div><div>:asio::time_traits&lt;boost::posix_time::ptime&gt;,boost::asio::deadline_timer_service</div>


<div>&lt;boost::posix_time::ptime,boost::asio::time_traits&lt;boost::posix_time::ptime&gt; &gt;�</div><div>&gt;::basic_deadline_timer&lt;boost::posix_time::ptime,boost::asio::time_traits&lt;boost:</div><div>:posix_time::ptime&gt;,boost::asio::deadline_timer_service&lt;boost::posix_time::ptime</div>


<div>,boost::asio::time_traits&lt;boost::posix_time::ptime&gt; &gt; &gt;(boost::asio::io_service�</div><div>&amp; io_service={...}) �Line 147<span style="white-space:pre-wrap">	</span>C++</div><div>OneComShim.dll!CORE::SERVER_COMMUNICATOR::CurlHandler::CurlHandler(CORE::SERVER_</div>


<div>COMMUNICATOR::ServerAgent * serverAgent=0x1029c950) �Line 37 + 0x118 bytes<span style="white-space:pre-wrap">	</span></div><div>C++</div><div>OneComShim.dll!CORE::SERVER_COMMUNICATOR::ServerAgent::ServerAgent() �Line 22<span style="white-space:pre-wrap">	</span></div>


<div>C++</div><div>OneComShim.dll!`dynamic initializer for�</div><div>&#39;CORE::SERVER_COMMUNICATOR::ServerAgent::agent&#39;&#39;() �Line 17 + 0x28 bytes<span style="white-space:pre-wrap">	</span></div>
<div>C++</div><div>TestWin.exe!TestWin.Program.Main(string[] args = {string[0x00000000]}) Line 16 +�</div><div>------------------------------------------------</div><div><br></div><div>As it can be seen, it stops in start_thread inside win_thread.ipp at following�</div>


<div>lines on WaitForSingleObject</div><div><br></div><div>if (entry_event)</div><div>{</div><div>� ::WaitForSingleObject(entry_event, INFINITE);</div><div>� ::CloseHandle(entry_event);</div><div>}</div><div><br></div><div>


I am just creating a timer object in the code and do not understand why it leads�</div><div>to this situation. Also everything works fine when I use a LIB instead of DLL�</div><div>and all code is in C++.</div><div><br></div>


<div>Environment details are as follows</div><div>OS: Win XP</div><div>IDE: Visual Studio 2010</div><div>Boost version: boost_1_48_0</div><div><br></div><div>Regards,</div><div>Chaitanya</div></div></div></div>
</div><br></div>
</div><br></div>