merge upstream patch r8983 (merged mingw build fixes from RC_0_16)