cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [ curl-Bugs-1824894 ] Recent addition of ws2tcpip.h to curl.h breaksC++ apps (fwd)

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Sat, 03 Nov 2007 05:58:55 +0100

> You added the ws2tcpip.h include in include/curl/curl.h to get the socklen_t
> typedef, but apparently we broke C++ builds with that change:
>
> https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1824894&group_id=976
>
> Would be useful with some attention from someone with one of those Windows C++
> compilers...

I don't have a working MSVC++ compiler setup at the moment. But the reporter of
the problem proposed a solution. Here's a more elegant version:

RCS file: /cvsroot/curl/curl/include/curl/curl.h,v
retrieving revision 1.331
diff -u -r1.331 curl.h
--- curl.h 15 Oct 2007 18:32:01 -0000 1.331
+++ curl.h 3 Nov 2007 04:55:21 -0000
@@ -43,10 +43,6 @@

 typedef void CURL;

-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /*
  * Decorate exportable functions for Win32 DLL linking.
  * This avoids using a .def file for building libcurl.dll.
@@ -183,6 +179,11 @@
 #define curl_socket_typedef
 #endif /* curl_socket_typedef */

+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 struct curl_httppost {
   struct curl_httppost *next; /* next entry in the list */
   char *name; /* pointer to allocated name */
)

This way <ws2tcpip.h> and other headers are outside the __cplusplus
block.

--gv
Received on 2007-11-03