That section of README_WINDOWS might be outdated. Line 24 of that same
Thrift.h file includes windows/config.h so the following one on line 28 may
be redundant. My initial impression is that the first one under #ifdef
_WIN32 should be the only one needed.

I agree that instantiating TWinsockSingleton in TServerSocket::listen() is
a good approach. I had manually called WSAStartup when using TCP sockets
under Windows which isn't as convenient. Would you (Lingfeng) or Denis
submit a patch for that? I could do it but don't want to take credit for it
unless you don't mind me submitting the patch.


  ------------------------------
*From:* Lingfeng Zhuang
*To:* [email protected]
*Sent:* Thursday, May 3, 2012 11:42 AM
*Subject:* Re: Thrift C++ on windows reports WSAPoll error

I just checked out latest code from SVN.

As README_WINDOWS said, I defined HAVE_CONFIG_H. When building, compiler
reports

“config.h”: No such file or directory c:\thrift\lib\cpp\src\thrift\thrift.h
28 1 server

I have to change all
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

to

#ifdef HAVE_CONFIG_H
#include "windows/config.h"
#endif

After it, compiling succeed. But console reports the error when running.

Starting the server...
Thrift: Fri May 04 00:37:23 2012 TServerSocket::listen() socketpair() errno
= 10093
Thrift: Fri May 04 00:37:23 2012 getaddrinfo 10093: application does not
call WSAStartup, or WSAStartup failed.

It runs fine after changing TServerSocket::listen to (as Denis said)

void TServerSocket::listen() {
#ifdef _WIN32
TWinsockSingleton::create();
#endif // _WIN32

Regards,

zlf


On Thu, May 3, 2012 at 10:41 PM, Peace wrote:

Thrift explicitly defines WSAPoll() since XP does not support that call. It
was introduced in Vista. There was a bug in the Thrift Windows code that
caused it to never follow the XP path to define WSAPoll(). The patch in
THRIFT-1512 fixes this and should be available in the current Thrift 0.9
development code on the SVN trunk.

 ------------------------------
*From:* Lingfeng Zhuang
*To:* [email protected]
*Sent:* Thursday, May 3, 2012 8:25 AM
*Subject:* Thrift C++ on windows reports WSAPoll error

 Hi all,
I create an empty C++ project with VS2010. Config boost and thrift
include/lib folders. Add cpp tutorials files into
project(CppServer.cpp, Calculator.cpp, shared_types.cpp, SharedService.cpp
and tutorial_types.cpp)

But when running it, it reports error "The procedure entry point WSAPoll
could not be located in the dynamic link library WS2_32.dll"

I tested it against both of boost 1.47 and 1.49. None of them works. My
test environment is 32bit windows xp.

VS project file is attached.

Regards,

zlf

Reply via email to