Added code required to build DLL on Windows, and fixed warnings detected by VC.