Added headers needed for template instantiation
Missing stdio header
Added io.h header for dup declaration
Reflect type changes in wok build system
Missing headers and minor preprocessor fixes

Added stdint.h header for intptr_t declarations and fixed minor
preprocessor issue (wnt case under unix block & borland case).