
A few fairly miscellaneous fixups for Windows (MinGW) which fix shared library builds and fix error handling for sockets. (1) XDR functions on MinGW come from a library called 'libxdr', not 'librpc'. (2) To build a DLL under MinGW we need to pass the -no-undefined flag to the linker. (3) Socket compatibility header file replaces <winsock2.h> inclusion. This just defines a portable 'socket_errno()' function which returns errno in the normal case, or WSAGetLastError() in the Windows case. (4) Use socket_errno() instead of errno in a few cases (but only when the code can be compiled under Windows, ie. only in the remote client case). Example -- a dynamically linked virsh.exe (linked to libvirt-0.dll) accessing a remote libvirtd: $ src/.libs/virsh.exe -c test+tcp://192.168.2.128/default list Id Name State ---------------------------------- 1 test running If you want to compile this under Windows, you will need: (a) MinGW & MSYS (select the "candidate" versions of MinGW tools if you are using Vista or W2K8, since otherwise nothing works because of a known bug). (b) Install gcc 4 experimental package from MinGW site. It's called gcc-sjlj for reasons which escape me. (c) Install GnuTLS binary from http://www.gnu.org/software/gnutls/download.html. I'm using GnuTLS Windows binary 1.6.3 and I had to hand-hack the *.la files in that distribution because they contain incorrect paths. (d) Compile and install latest libxml2 from http://xmlsoft.org/. I'm using 2.6.30. (e) Compile and install my XDR package for Windows (http://www.annexia.org/tmp/xdr-4.0-mingw5.tar.gz) (f) ./configure --without-xen --without-qemu --without-sasl --without-libvirtd (g) make Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903