windows support & shared fd in output function

add win32 support, and using shared fd in output function, which significantly speed up.