platform compilation fixes to be compatible with clang and gcc on windows