Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2008-07-01 08:28:59


Jason Turner wrote:
> Some ASIO test code is crashing in a way that I do not understand. GDB is
> unable to debug it (no stack available on crash) and the error is a rather
> obtuse "This application has requested the Runtime to terminate it in an
> unusual way. Please contact the application's support team for more
> information."
>
>
> Test code which crashes:
>
> #include <boost/asio/ip/address.hpp>
> #include <iostream>
>
> int main()
> {
> std::cout << boost::asio::ip::address::from_string("1.1.2.3") <<
> std::endl;
> }

This is probably due to winsock not being initialised automatically as
it is supposed to. Does the following inclusion sequence make it work?

#include <boost/asio/ip/address.hpp>
#include <boost/asio/detail/winsock_init.hpp>
...

If winsock is not initialised then from_string will fail with an
exception, which you're not catching.

Cheers,
Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk