THRIFT-2579 C++ lib Windows CE support
diff --git a/lib/cpp/src/thrift/transport/PlatformSocket.h b/lib/cpp/src/thrift/transport/PlatformSocket.h
index 019f4cb..d28978e 100644
--- a/lib/cpp/src/thrift/transport/PlatformSocket.h
+++ b/lib/cpp/src/thrift/transport/PlatformSocket.h
@@ -50,7 +50,11 @@
 #  define THRIFT_READ _read
 #  define THRIFT_FSTAT _fstat
 #  define THRIFT_STAT _stat
-#  define THRIFT_GAI_STRERROR gai_strerrorA
+#  ifdef _WIN32_WCE
+#    define THRIFT_GAI_STRERROR(...) thrift_wstr2str(gai_strerrorW(__VA_ARGS__))
+#  else
+#    define THRIFT_GAI_STRERROR gai_strerrorA
+#  endif
 #  define THRIFT_SSIZET ptrdiff_t
 #  define THRIFT_SNPRINTF _snprintf
 #  define THRIFT_SLEEP_SEC thrift_sleep
diff --git a/lib/cpp/src/thrift/windows/WinFcntl.cpp b/lib/cpp/src/thrift/windows/WinFcntl.cpp
index f7b4337..3dd4e3d 100644
--- a/lib/cpp/src/thrift/windows/WinFcntl.cpp
+++ b/lib/cpp/src/thrift/windows/WinFcntl.cpp
@@ -102,3 +102,9 @@
 }
 #endif // WINVER
 
+#ifdef _WIN32_WCE
+std::string thrift_wstr2str(std::wstring ws) {
+	std::string s(ws.begin(), ws.end());
+	return s;
+}
+#endif
diff --git a/lib/cpp/src/thrift/windows/WinFcntl.h b/lib/cpp/src/thrift/windows/WinFcntl.h
index f30c0de..118c9a4 100644
--- a/lib/cpp/src/thrift/windows/WinFcntl.h
+++ b/lib/cpp/src/thrift/windows/WinFcntl.h
@@ -28,6 +28,10 @@
 #error This is a MSVC header only.
 #endif
 
+#ifdef _WIN32_WCE
+#include <string>
+#endif
+
 // Win32
 #include <Winsock2.h>
 #include <thrift/transport/PlatformSocket.h>
@@ -45,4 +49,8 @@
 int thrift_poll(THRIFT_POLLFD *fdArray, ULONG nfds, INT timeout);
 }
 
+#ifdef _WIN32_WCE
+std::string thrift_wstr2str(std::wstring ws);
+#endif
+
 #endif // _THRIFT_WINDOWS_FCNTL_H_
diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h
index 0555e07..dca55c9 100644
--- a/lib/cpp/src/thrift/windows/config.h
+++ b/lib/cpp/src/thrift/windows/config.h
@@ -84,7 +84,10 @@
 // windows
 #include <Winsock2.h>
 #include <ws2tcpip.h>
+#ifdef _WIN32_WCE
+#pragma comment(lib, "Ws2.lib")
+#else
 #pragma comment(lib, "Ws2_32.lib")
 #pragma comment(lib, "advapi32.lib") //For security APIs in TPipeServer
-
+#endif
 #endif // _THRIFT_WINDOWS_CONFIG_H_