Re: [gtk-vnc-devel] Porting gtk-vnc to Windows (MinGW)



On Tue, Dec 18, 2007 at 03:37:44PM +0000, Richard W.M. Jones wrote:
> I made a little attempt to port gtk-vnc over to Windows using MinGW & 
> MSYS, because we'd like to use gtk-vnc on Windows in various projects.
> 
> The port isn't going to be entirely straightforward, so here are my 
> notes, and attached is the output of 'make -k' after a few iterations so 
> you can see while files don't compile.
> 
> (1) getcontext/makecontext:
> 
> These are obviously missing on Windows.  Win32 has similar functions 
> 'GetThreadContext' and 'SetThreadContext', and there is an 
> implementation I found of the Unix functions in terms of the Windows 
> functions:
> 
> http://www.codeproject.com/KB/threads/ucontext.aspx?df=100&forumid=15621&exp=0&select=847762
> 
> I've mirrored the source files from the above page here; the license is 
> LGPLv2:
> 
> http://annexia.org/tmp/win32_ucontext/
> 
> So that is some hope that the continuation/coroutine stuff can be ported 
> with not too much work.

Looks like Anothony's thread based coroutine ought to solve this problem
for us.


> (2) Socket calls:
> 
> gvnc.c:13:24: error: sys/socket.h: No such file or directory
> gvnc.c:14:24: error: netinet/in.h: No such file or directory
> gvnc.c:15:23: error: arpa/inet.h: No such file or directory
> gvnc.c:17:19: error: netdb.h: No such file or directory
> 
> When I ported libvirt, I found that most socket calls could be replaced 
> just by modifying the header files to include <winsock2.h>, as in:
> 
> #ifndef HAVE_WINSOCK2_H
> #include <sys/socket.h>
> #include <netdb.h>
> #include <netinet/in.h>
> #include <netinet/tcp.h>
> #else
> #include <winsock2.h>
> #endif
> 
> A few other changes were needed in libvirt but they weren't very invasive.

Yep, no problem with those.The only other complication IIRC is special
errno handling for Winsock.

> 
> (3) getaddrinfo:
> 
> With libvirt we found that the best idea was to use the Gnulib 
> implementation of getaddrinfo and a handful of other functions.  Gnulib 
> is a source library of useful functions which replaces functions where 
> they are broken or missing on a platform (but otherwise leaves code 
> unchanged).  More about Gnulib here: http://www.gnu.org/software/gnulib/
> 
> Gnulib also contains wrappers which add missing macros such as F_GETFL, 
> O_NONBLOCK.
> 
> Would gtk-vnc developers be happy with patches which pull in parts of 
> Gnulib?

That's fine by me - the way we did it in libvirt worked very nicely.


Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]