Boost C++ Libraries: Ticket #13364: xxx please delete - it was my fault xxx https://svn.boost.org/trac10/ticket/13364 <p> The steady_timer is working fine when it is started in the executeable. By starting the steady_timer in the dll, the timer expires immediately. I think this is a bug, isn't it? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13364 Trac 1.4.3 anonymous Tue, 26 Dec 2017 00:10:16 GMT <link>https://svn.boost.org/trac10/ticket/13364#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13364#comment:1</guid> <description> <p> I'm working with Visual Studio 2017 V15.5.2. Sorry, can't add attachments. So i list the source here: </p> <p> api.h: </p> <hr /> <p> #include &lt;boost/asio.hpp&gt; </p> <p> class my_api { public: </p> <blockquote> <p> virtual void startTimer(boost::asio::io_service&amp; ioservice) = 0; </p> </blockquote> <blockquote> <p> virtual ~my_api() {} </p> </blockquote> <p> }; </p> <p> dll.cpp </p> <hr /> <p> #include &lt;iostream&gt; #include &lt;boost/dll.hpp&gt; #include "api.h" </p> <p> class my_plugin : public my_api { public: </p> <blockquote> <p> void startTimer(boost::asio::io_service&amp; ioservice) { </p> <blockquote> <p> std::cout &lt;&lt; "start timer (15 sec)\n"; boost::asio::steady_timer timer{ ioservice, std::chrono::seconds{ 15 } }; timer.async_wait([](const boost::system::error_code &amp;ec) { std::cout &lt;&lt; "15 sec\n"; }); </p> </blockquote> <p> }; </p> </blockquote> <blockquote> <p> ~my_plugin() {}; </p> </blockquote> <p> }; </p> <p> static boost::shared_ptr&lt;my_api&gt; createPlugin() { </p> <blockquote> <p> return boost::shared_ptr&lt;my_api&gt;(new my_plugin()); </p> </blockquote> <p> } </p> <p> BOOST_DLL_ALIAS( </p> <blockquote> <p> createPlugin, create_plugin </p> </blockquote> <p> ) </p> <p> <a class="missing wiki">AsioProblem</a>.cpp: </p> <hr /> <p> #include "stdafx.h" </p> <p> #include &lt;boost/dll/import.hpp&gt; #include &lt;boost/function.hpp&gt; #include &lt;boost/asio.hpp&gt; #include &lt;iostream&gt; #include "../DLL/api.h" </p> <p> namespace dll = boost::dll; </p> <p> int main() { </p> <blockquote> <p> boost::asio::io_service ioservice; </p> </blockquote> <blockquote> <p> /* load dll */ boost::filesystem::path shared_library_path("..<br />Debug"); shared_library_path /= "DLL"; </p> </blockquote> <blockquote> <p> boost::function&lt;boost::shared_ptr&lt;my_api&gt;()&gt; creator = boost::dll::import_alias&lt;boost::shared_ptr&lt;my_api&gt;()&gt;( </p> <blockquote> <p> shared_library_path, "create_plugin", boost::dll::load_mode::append_decorations ); </p> </blockquote> <p> boost::shared_ptr&lt;my_api&gt; plugin = creator(); </p> </blockquote> <blockquote> <p> /* set timer 10 sec */ std::cout &lt;&lt; "start timer (10 sec)\n"; boost::asio::steady_timer timer{ ioservice, std::chrono::seconds{ 10 } }; timer.async_wait([](const boost::system::error_code &amp;ec) { std::cout &lt;&lt; "10 sec\n"; }); </p> </blockquote> <blockquote> <p> /* create my_plugin in dll with timer 15 sec */ plugin-&gt;startTimer(ioservice); </p> </blockquote> <blockquote> <p> ioservice.run(); </p> </blockquote> <p> </p> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 26 Dec 2017 21:30:57 GMT</pubDate> <title>summary changed https://svn.boost.org/trac10/ticket/13364#comment:2 https://svn.boost.org/trac10/ticket/13364#comment:2 <ul> <li><strong>summary</strong> <span class="trac-field-old">steady_timer doesn't work in dll</span> → <span class="trac-field-new">xxx please delete - it was my fault xxx</span> </li> </ul> Ticket