I have a simple tutorial based asio boost code that works fine when called from exe, but crashes when starting from a DLL using LoadLibrary. It crashes inside the promotion code, not my code. It will work inside its mutex stream functions in 90% of cases. Are there any restrictions when executing code inside a dll compared to exe?
This is my code:
Connection::Connection(boost::asio::io_service& ioservice)
: m_Socket(ioservice)
, m_Resolver(ioservice)
{
}
void Connection::ConnectTo()
{
boost::asio::ip::tcp::resolver::query query("www.google.com", "http");
boost::asio::ip::tcp::resolver::iterator iterator = m_Resolver.resolve(query);
boost::asio::ip::tcp::endpoint endpoint = *iterator;
m_Socket.async_connect(endpoint,
boost::bind(&Connection::HandleConnect, shared_from_this(),
boost::asio::placeholders::error, ++iterator));
}
void Connection::HandleConnect( const boost::system::error_code& e,
boost::asio::ip::tcp::resolver::iterator endpoint_iterator )
{
}
Is there a reason why this code could happen with an error inside the dll rather than exe? Please note that these are only asynchronous calls that fail. Sync is working fine
thank
source
share