Proper platform detection. Use target instead of host. Fix compilation for non win32 and non x86_64 platforms.