Turn run-time checks into compile-time ones

Instead of switching by operating system in runtime, #ifdef corresponding code.