Conflict with LWIP sockets.h definition in mongoose.c

#1

Mongoose.c calls a poll(x,y) from vtable:

int mg_mgr_poll(struct mg_mgr *m, int timeout_ms) {
  int i, num_calls_before = m->num_calls;
  for (i = 0; i < m->num_ifaces; i++) {
    m->ifaces[i]->vtable->poll(m->ifaces[i], timeout_ms);
  }
  return (m->num_calls - num_calls_before);
}

And it’s running into a conflict with a poll macro setup in LWIP’s socket.h:

c:\nxp\imxrt1060-evk_ciras4\thirdparty\lwip\src\include\lwip\sockets.h:653:0: note: this is the location of the previous definition
 #define poll(fds,nfds,timeout)                    lwip_poll(fds,nfds,timeout)

What would be the best solution?

#2

Did you try to disable LWIP_SOCKET_POLL in lwipopts.h?

#3

I did, that’s the solution I’m using now. Which is odd, because LWIP_SOCKET being 0 has that block of code disabled. So something is amiss in LWIP’s sockets.h or MCUxpresso’s interpreter…??

Apparently there’s this new poll() macro in the later version(s) of LWIP though. Perhaps an #undef is needed in the right place within mongoose.c to prevent conflict in the event someone us using LWIP sockets.