I think I've seen this issued discussed briefly either here on the forum or on GitHub, but I can't find the post now so I'll ask again.
lwip defines a lot of macros with very general names such as connect, bind, send etc. in socket.h. These macros gives quite a few headaches since they clash with other code, both in the standard library and my own.
To handle these I've had to be very careful in what order files are included, but also do dirty tricks such as this:
Code: Select all
#undef write
#undef read
#undef bind
So by turning this
Code: Select all
#define read(s,mem,len) lwip_read_r(s,mem,len)
#define write(s,dataptr,len) lwip_write_r(s,dataptr,len)
Code: Select all
inline int read(int s,void* mem, size_t len) {return lwip_read_r(s,mem,len);}
inline int write(int s,const void* dataptr, size_t len) {return lwip_write_r(s,dataptr,len); }
Thoughts? Comments?
Would this be welcome as a PR?