[ python-Bugs-860134 ] socketmodule.c does not pickup all symbols with MS visC++

SourceForge.net noreply at sourceforge.net
Sat Feb 7 21:28:08 EST 2004


Bugs item #860134, was opened at 2003-12-14 18:27
Message generated for change (Comment added) made by jeffconnelly
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=860134&group_id=5470

Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Frank Terhaar-Yonkers (frankty)
Assigned to: Nobody/Anonymous (nobody)
Summary: socketmodule.c does not pickup all symbols with MS visC++

Initial Comment:
The symbol: socket.IP_HDRINCL does not exist is the
Win32 Python binary I downloaded/installed of Python
v2.3, nor does it appear when I compile 2.3.3RC1 with
MS Visual C++.

If I add the following to socketmodule.c:
 (per the example in the windows SDK
./Samples/netds/WinSock/iphdrinc/rawudp.c)

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 
#endif
#include <winsock2.h>
#include <ws2tcpip.h>

All is well ..

I've no idea what symbol to #ifdef this on as this is
the first time I've compiled anything on "winders"  :-)
Any no idea if "lean_and_mean" is required - all I know
is that it now works ..

cheers,

- Frank
fty at employees.org


----------------------------------------------------------------------

Comment By: Jeff Connelly (jeffconnelly)
Date: 2004-02-07 18:28

Message:
Logged In: YES 
user_id=31953

P.S.: To get Winsock 2 working with Python, the _socket 
project must link with ws2_32.lib instead of wsock32.lib. 
Under VC++ 6 this can be done like this: Project -> Settings -
> highlight "_socket", Win32 release -> Link tab -> in 
the "Object/library modules" field change wsock32.lib to 
ws2_32.lib.


----------------------------------------------------------------------

Comment By: Jeff Connelly (jeffconnelly)
Date: 2004-02-07 18:15

Message:
Logged In: YES 
user_id=31953

Defining WIN32_LEAN_AND_MEAN doesn't seem to work. The 
problem appears to be line 16 of socketmodule.h, which 
includes WinSock 2 #if _MSC_VER >= 1300 and WinSock 1 
otherwise. (IP_HDRINCL is a part of WinSock 2.) Apply this 
patch to use WinSock 2 on MS VC++ 6 (1200), which is what 
the Python Win32 builds are compiled with. (1300 is .Net?) 
pyconfig.h also needs to be patched.

socketmodule.h.patch:
17c17
< #if _MSC_VER >= 1300
---
> #if _MSC_VER >= 1200

pyconfig.h.patch:
327c327
< #if _MSC_VER + 0 >= 1300
---
> #if _MSC_VER + 0 >= 1200


With these patches, IP_HDRINCL exists in socket:

C:\>python
Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> import socket
>>> socket.IP_HDRINCL
2
>>>



----------------------------------------------------------------------

Comment By: Frank Terhaar-Yonkers (frankty)
Date: 2003-12-15 11:45

Message:
Logged In: YES 
user_id=931285

I have NO IDEA how it got assigned to you.  I don't even
know who you are ..

Sorry for any hassle.

cheers - Frank

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2003-12-15 08:27

Message:
Logged In: YES 
user_id=11105

Please don't assign bug reports to a developer (especially
not me ;-).
Usually they stay unassigned until someone cares (when he
has the time).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=860134&group_id=5470



More information about the Python-bugs-list mailing list