Fix mingw

This fixes compilation when using MinGW under Windows.

Fixes #1044.