KDE/kdelibs/kdecore/network

Shane King kde at dontletsstart.com
Wed Nov 21 08:05:22 CET 2007


Christian Ehrlicher wrote:
>> Von: Shane King
>> Christian Ehrlicher wrote:
>>> Shane King schrieb:
>>>> SVN commit 739431 by shakes:
>>>>
>>>> Use the netsupp.h definitions of inet_ntop/inet_pton even on msvc as
>> the platform sdk exposed ones are only valid for vista
>>>>
>>>>  M  +0 -2      k3socketaddress.cpp  
>>>>
>>>>
>>>> --- trunk/KDE/kdelibs/kdecore/network/k3socketaddress.cpp
>> #739430:739431
>>>> @@ -41,9 +41,7 @@
>>>>  
>>>>  #include "klocale.h"
>>>>  
>>>> -#ifndef Q_CC_MSVC
>>>>  #include "netsupp.h"
>>>> -#endif
>>>>  
>>>>  using namespace KNetwork;
>>>>  
>>> This will *not* work with PSDK 6 and up.
>>> Please remove this and take a look into kdewin32 library to see how it's
>>> currently done.
>>> I know this solution does not work when someone compiles (and releases)
>>> kdelibs with PSDK 6 and up but that's not a problem you have to be aware
>> of.
>>> Don't change such fundamental changes without asking us - we needed a
>>> lot of time to make it work the way it is now...
>>>
>>> Christian
>>>
>>
>> I have the latest psdk (6.0a as shipped with vs 2008) and it works for 
>> me. I assumed it was an oversight because someone probably saw it worked 
>> against vista's winsock (the commit comment for the original change said):
>>
>> "MSVC doesn't need these with the latest win32 SDK apparently. Although 
>> I would appreciate it if this could be checked over."
>>
>> I checked it over, found it didn't work for me (as I'm using xp, and it 
>> causes anything liked against kdecore to fail at startup with inet_ntop 
>> being undefined in ws2_32.dll), and changed it back.
>>
>> As the netsupp.cpp file uses netsupp.h without an include protection 
>> (and hence uses the custom inet_ntop), it seemed the correct thing to do.
>>
>> If I thought that was controversial I would have asked, but it seemed a 
>> pretty straightforward change given the circumstances. I'm happy to 
>> change it back, but that leaves it broken for me ... what do you feel 
>> the correct fix is?
>>
> Ok, so it looks like the compiler errors only occur with PSDK 6.0 (without a) - I know for sure that I got them (and switched back to PSDK 5.x afterwards because of this).
> 
> I would suggest to fix this problem in kdewin32 library:
> - define inet_pton/ntop to kde_inet_pton/ntop to avoid name clashing with PSDK > 6
> - on first run check for inet_pton/ntop symbols in ws2_32.dll and use them if possible, otherwise use the kdewin32 implementation (= the same like in netsupp.cpp)
> - to not change k3socketaddress.cpp sources we define kde_inet_ntop inet_ntop in kdewin32 header. It should work because winsock2 is included before the kdewin32 header
> 
> Is this ok?
> 
> 
> Christian

Sounds like a workable solution to me.

Shane.



More information about the Kde-windows mailing list