Here is the basic steps:

1) I upgraded my cygwin from 1.5.5 to 1.7.18 (latest version as of today) there is no way to go back to older version after you upgrade so I would make necessary backup just in case you need to go back.
2) update your compiler_gnu.h and types.h in your c:\QNX650\host\win32\x86\usr\include\libqnx\sys with the attached file
3) replace the cygwin1.dll in your c:\QNX650\host\win32\x86\usr\photon\bin 
4) replace the string.h file in your c:\cygwin\usr\include\ (this is kind of cheating but I had no time to troubleshoot and update all QNX .h file to match the new cygwin gcc version.  I know I don't use string.h in my dll so just took the string.h from the old cygwin 1.5.5 version.
5) now you can compile and link your custome widget code with following commands
(compile)
gcc -c -nostdinc -I /lib/gcc/i686-pc-cygwin/3.4.4/include -I/cygdrive/c/QNX632/host/win32/x86/usr/include -I/usr/include -I/cygdrive/c/qnx650/target/qnx6/usr/include custom.c
(link)
gcc -shared -o custom.dll custom.o -L/cygdrive/c/qnx650/host/win32/x86/usr/lib/ -lph -lcygwin -lkernel32