fix linkage and warnings for mingw