lwip-devel
[Top][All Lists]
Advanced

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

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


From: Gisle Vanem
Subject: [lwip-devel] 'struct in_addr' and Windows headers
Date: Mon, 7 Dec 2015 13:22:51 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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



reply via email to

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