Msvc linker fixes + static libs

Fixes some build issues on msvc.
Fixes build with SC_BUILD_STATIC_LIBS=ON and SC_BUILD_SHARED_LIBS=OFF.