minor casts and DLLEXPORT fixes for MSVC

some little fixes post-#8656 for MSVC compilation. @vtjnash any objections?