Mingw support

Hopefully this greatly improves support on old GCCs too.