lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] 'struct in_addr' and Windows headers


From: Joel Cunningham
Subject: Re: [lwip-devel] 'struct in_addr' and Windows headers
Date: Mon, 07 Dec 2015 20:47:29 +0000 (GMT)

If libcurl supports using LwIP instead of winsock (while building on Windows), shouldn't it not be including the winsock headers, i.e. <inaddr.h>?  This way we aren't including multiple definitions for the same types?

Joel

On Dec 07, 2015, at 06:23 AM, Gisle Vanem <address@hidden> wrote:

The libcurl project have supported building using lwIP as a
replacement tcp/ip stack on Windows for some years. (at least
as an experiment. It may not actually work?).

But since the MS SDK 8.1 + WindowsKit was released, it has become more
difficult. One reason is the MS <inaddr.h> with no header-guard. Only
this:
#ifndef s_addr
typedef struct in_addr {
union {
struct { UCHAR s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { USHORT s_w1,s_w2; } S_un_w;
ULONG S_addr;
} S_un;
#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
...
#endif

This clashes with lwIP's <include/lwip/inet.h> since it
has:
struct in_addr {
in_addr_t s_addr;
};


Would it be possible to patch it like so?

--- a/include/lwip/inet.h 2015-10-12 23:35:36
+++ b/include/lwip/inet.h 2015-12-07 12:49:27
@@ -56,9 +56,11 @@
#endif

struct in_addr {
- in_addr_t s_addr;
+ in_addr_t S_addr;
};

+#define s_addr S_addr
+
struct in6_addr {
union {
u32_t u32_addr[4];

-----

Thus the 's_addr' makes the C preprocess stage skip the <inaddr.h> file
all together.

--
--gv

_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]