Fixups for Mingw support Issue #140

Feel free to modify it as you see fit. I've already tested the various configuration combinations  against Mingw gcc 4.6.3 and everything seems to be working okay now. Let me know if you have any questions or feedback regarding the patch.