Fix build for msvc compilers.
Support static library building without public exports.