Fixed compilation for MSVC
Added platform.h and other fixes for MSVC
Added cast to keep MSVC happy
Merge pull request #252 from hintjens/master

Fixed compilation for MSVC