diff --git a/mongoose.h b/mongoose.h index 24e2df24..24966431 100644 --- a/mongoose.h +++ b/mongoose.h @@ -171,7 +171,9 @@ extern "C" { #if MG_ARCH == MG_ARCH_FREERTOS #include -// #include // Cannot include errno - might conflict with lwip! +#if !defined(MG_ENABLE_LWIP) || !MG_ENABLE_LWIP +#include +#endif #include #include #include @@ -179,7 +181,12 @@ extern "C" { #include #include // rand(), strtol(), atoi() #include +#if defined(__ARMCC_VERSION) +#define mode_t size_t +#include +#else #include +#endif #include #include @@ -564,8 +571,17 @@ static inline int mg_getpeername(MG_SOCKET_TYPE fd, void *buf, socklen_t *len) { #if defined(MG_ENABLE_LWIP) && MG_ENABLE_LWIP -#if defined(__GNUC__) + +#if defined(__GNUC__) && !defined(__ARMCC_VERSION) #include +#endif + +struct timeval; + +#include + +#if !LWIP_TIMEVAL_PRIVATE +#if defined(__GNUC__) && !defined(__ARMCC_VERSION) // armclang sets both #include #else struct timeval { @@ -573,8 +589,7 @@ struct timeval { long tv_usec; }; #endif - -#include +#endif #if LWIP_SOCKET != 1 // Sockets support disabled in LWIP by default @@ -586,9 +601,7 @@ struct timeval { #if defined(MG_ENABLE_RL) && MG_ENABLE_RL #include -#define MG_ENABLE_CUSTOM_MILLIS 1 #define closesocket(x) closesocket(x) -#define mkdir(a, b) (-1) #define TCP_NODELAY SO_KEEPALIVE diff --git a/src/arch_freertos.h b/src/arch_freertos.h index eb9615d3..345c0db4 100644 --- a/src/arch_freertos.h +++ b/src/arch_freertos.h @@ -3,7 +3,9 @@ #if MG_ARCH == MG_ARCH_FREERTOS #include -// #include // Cannot include errno - might conflict with lwip! +#if !defined(MG_ENABLE_LWIP) || !MG_ENABLE_LWIP +#include +#endif #include #include #include @@ -11,7 +13,12 @@ #include #include // rand(), strtol(), atoi() #include +#if defined(__ARMCC_VERSION) +#define mode_t size_t +#include +#else #include +#endif #include #include diff --git a/src/net_lwip.h b/src/net_lwip.h index d137e919..0aee72f2 100644 --- a/src/net_lwip.h +++ b/src/net_lwip.h @@ -1,8 +1,17 @@ #pragma once #if defined(MG_ENABLE_LWIP) && MG_ENABLE_LWIP -#if defined(__GNUC__) + +#if defined(__GNUC__) && !defined(__ARMCC_VERSION) #include +#endif + +struct timeval; + +#include + +#if !LWIP_TIMEVAL_PRIVATE +#if defined(__GNUC__) && !defined(__ARMCC_VERSION) // armclang sets both #include #else struct timeval { @@ -10,8 +19,7 @@ struct timeval { long tv_usec; }; #endif - -#include +#endif #if LWIP_SOCKET != 1 // Sockets support disabled in LWIP by default diff --git a/src/net_rl.h b/src/net_rl.h index 2e4b6874..4c0e3890 100644 --- a/src/net_rl.h +++ b/src/net_rl.h @@ -3,9 +3,7 @@ #if defined(MG_ENABLE_RL) && MG_ENABLE_RL #include -#define MG_ENABLE_CUSTOM_MILLIS 1 #define closesocket(x) closesocket(x) -#define mkdir(a, b) (-1) #define TCP_NODELAY SO_KEEPALIVE