[Patch] fix compile kdecore with msvc

Ralf Habacker ralf.habacker at freenet.de
Sat Oct 29 22:15:08 BST 2005

Am Samstag, 29. Oktober 2005 20:20 schrieb Christian Ehrlicher:
> Hi,
> i've attached a small patch which allows me to compile and link kdecore
> with msvc.
> Changes:
> network/kresolver.cpp
> - masked '#warning' - is gnuc-specific
> network/kresolver.h
> - don't export KResolverResults to avoid compiler errors (*)
> network/ksocketdevice.cpp
> - don't include ksockssocketdevice in windows to avoid linker errors
> - indentation fixes (tabulator -> spaces)
> - add kde_ioctl because ioctl isn't available in windows
> network/syssocket.h
> - add kde_ioctl (**)

there may be a similar function required for close. 
Windoes does closesocket() for sockets and close for files() :-(

A function like kde_close() may be usefull. I've tried to write one, but fails 
in detecting if a fd is a socket fd. Perhaps anyone else know this. 

// replacement for unix close function 
inline void kde_close(int fd, char *a, int b)
	u_long res; 
	if (/* is socket file descriptor */ /*ioctlsocket(fd,FIONREAD,&res) == 0*/ ){
	else {

> SConscript
> - add 'DMAKE_KDECORE_LIB' to ccflags instead cxxflags
> * there is imho no need to export KResolverResults because nobody
> derivates a class from KResolverResults. And if you really want to
> export this class, you have to implement all functions QList<T> defines
> because otherwise when someone wants to use a function you forgot to
> implement he will get a linker error.
> ** I don't know excatly if this is the correct place, but I wouldn't put
> this into win/include/msvc and win/include/mingw. The problem here is,
> that ioctl is defined as ioctlsocket(int fd, int cmd, u_long* argp) and
> I have to use a temporary variable to map between int and long.
> I've another question regarding some header files: In win/include/ we've
> some headers which are empty. Wouldn't it be better to avoid including
> them instead using empty headerfiles? Shouldn't be a problem to mask
> them with '#ifdef HAVE_XXX', or?
which would require additional configure checks and source patching. For mingw 
is seems easier to me to add empty  header as placeholder. If sometime in the 
future additional definitions in such file is placed, it is already there. 

The platform related win/include dirs are designed as a compiler specific 
"posix gap filler" , because every compiler on windows has  more or less 
complete posix support which also are different between each other. 


More information about the kde-core-devel mailing list