modifications based on TexMachs comments

per comments and code from François Poulain, modifiers to allow support
of gcc/mingw