Unfortunately in order for this to work correctly it was necessary to decide a particular version to be compatible with, as the Memcached addon uses functionality that is implemented via two incompatible interfaces between older versions (such as libmemcached 0.39 and previous) and new versions (1.0.2 and later).
With these changes the Memcached addon is only compatible with libmemcached versions 1.0.2+.
NOTE: I have not tested these changes as I do not have any Io code that uses Memcached and there do not appear to be any unit tests.
I originally ended up making these changes due to a previous fix that broke compatibility with earlier versions of libmemcached (098921f).
Eventually I decided to make these particular changes after determining that it was not possible to use a single set of functionality from libmemcached that worked across all versions. Because these changes were primarily focused on unbreaking my own build, it is possible that the Memcached addon still has code which uses the non-official/public API of libmemcached.
Memcached stats method compatiblity fix
The stats method of Memcached is now compatible with libmemcached 1.0+.
Further Memcached compatibility fixes
The Memcached addon is now compatible with the API for libmemcached 1.0
throughout. The stats method also sets the error state if errors were
Pulling - thanks Charles :)