Fix build for mingw and dll linking