ensure libraries get searched in the right order, at least for mingw (don't know about msvc)