Support for GCC

Testetd and adopted the source code to support gcc.
Tested with mingw on Win7 x64