Fix linking on Windows

This fixes a dynamic linking error when building on Windows with `mingw`.