Add support for building on/cross-compiling the shared library for Windows and OS X

Also ensure that the shared library is versioned, and an implib is created on
Windows.