1

I'm looking at libraries to help build a scalable tcp/ip server, and Boost::ASIO looks pretty nice to make async socket i/o work homogeneously across platforms (We need to support at least OSX, Linux x86, and Windows, probably Solaris, maybe HP-UX & AIX).

Management is dead-set against using Boost in our product, mostly due to it being 'bloated', and due to issues we've had in the past with conflicts, as our code gets statically linked with customer code (which may also be using boost, possibly not the same version).

The Asio page claims that it can be used without boost, although it's pretty vague, as later it also says "When using C++11 ... Asio can be used independently of Boost ...", which seems to imply it won't work on a C++03 compiler. I was thinking I could simply do a '#define asio proprietary_asio' before including the header to avoid the symbol clash issue.

I just tested VS2013 on my local machine, and it compiled; Does anyone know which particular C++11 features are needed? I need to (at the very least) support VS2012/2013 on windows, gcc 4.4 (maybe 4.3) on linux, and XCode 5.1 on OSX.

I'm guessing the problem is going to be with the old version of GCC...

Tanner Sansbury
  • 51,153
  • 9
  • 112
  • 169
Bwmat
  • 4,314
  • 3
  • 27
  • 42
  • It's extremely confusing. The library claims to be standalone, but I find a bunch of includes for boost headers inside of it. Best I can do is point you here https://think-async.com/Asio/AsioAndBoostAsio and suggest building out a sample application to test and see by using the appropriate defines, you can compile a boost-free, non-C++11 sample. –  Apr 15 '15 at 23:16
  • This [answer](http://stackoverflow.com/a/16086836/1053968) to a similar question may provide some help – Tanner Sansbury Apr 16 '15 at 03:28
  • 1
    Management wants a flexible transport solution for persons. But they are dead-set against cars as cars are bloated because cars come with wheels and seats and windshield and so on. I'm sorry, your problem is not boost. – stefan Apr 17 '15 at 21:56

3 Answers3

1

I've used ASIO with MS VC++ 2013, without using any other parts of Boost.

Most ASIO code uses boost::bind, but VC++ 2013 includes a std::bind that works fine for the job. A fair amount of Boost demo code also uses boost::array, but this is just a fairly ordinary array--you can use std::array, or std::vector, or any number of other possibilities.

Warning: while this has worked fine for me in what I've done, I'm pretty certain I haven't used all parts of ASIO, and I'm ever more certain I haven't combined them in every possible way. As such, I can say it has worked, and I don't recall any issues that seemed to be related to lack of using other parts of Boost, but at the time time, it's always possible that (depending what you use and how) you could run into an issue I simply never encountered (e.g., something that works with boost::bind that just doesn't work (at least the same way) with VC++ 2013's implementation of std::bind.

The other compilers are a lot less certain--with a newer version of gcc, there would be no problem, but 4.4 or 4.3 is pretty darned old. It's been long enough since I did anything on OS X that I'm uncertain what compiler goes with XCode 5.1.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • I'm wondering about the minimum required, not about what's in the examples or necessarily easy to use (we'll probably do custom functor classes for handlers, since no lambdas) – Bwmat Apr 16 '15 at 04:50
0

Asio might be using placeholder or smart pointers or even bind() function which were parts of boost and were included in C++11 std library. Without those, you can't use asio.

MicroCheapFx
  • 392
  • 1
  • 2
  • 15
-1

https://github.com/chriskohlhoff/asio/tree/master/asio/src/examples

It appears that Asio's examples are filled with both C++03, C++11, and C++14 version. In this vein, Asio should work with C++03

CinchBlue
  • 6,046
  • 1
  • 27
  • 58
  • 1
    Yes, but I'm wondering which C++11 features are required if you use it completely without boost. It seems that it 'fills in' some missing features as needed by borrowing from boost when you build it on a C++03 compiler. – Bwmat Apr 15 '15 at 21:37