Mostly changes to lib to accomodate win32

Some thing had to change to the simple c++ wrapper
to be created and some windows functionality to work.