remove unnecessary link flags when building libraries
properly use shared libraries on windows, fix #387