boost bind conflicting with socket bind

Hello,
My Socket code that contains call to "bind" to a port is conflicting with boost::bind in 1.36. It compiles fine under boost 1.34 and 1.35. Interestingly, nothing is included from boost in that file. I am using boost with mingw on Win Xp.
The code snippet is as follows:
int Socket::BindPort(int family, int address, int port) {
sockaddr_in sa;
int dwError = RERROR_SUCCESS;
memset(&sa, 0, sizeof(sa));
sa.sin_family = family;
sa.sin_addr.s_addr = address;
sa.sin_port = htons(port);
if (bind(s_, (sockaddr *)&sa, sizeof(sockaddr_in)) == SOCKET_ERROR) {
dwError = RERROR_SOCKET_BIND_ERROR;
LOG (LOG_ERR, "Could not bind socket to port %u", port);
BAIL_ON_ERROR (dwError);
}
error:
return dwError;
}
Here is what I am getting...
[g++] [Socket.o]<-[Socket.cpp]
E:/msys/1.0/boost/boost_1_36_0/boost/bind.hpp: In instantiation of `boost::_bi::result_traits

Sharad Mittal:
Hello, My Socket code that contains call to "bind" to a port is conflicting with boost::bind in 1.36. It compiles fine under boost 1.34 and 1.35. Interestingly, nothing is included from boost in that file. I am using boost with mingw on Win Xp.
The code snippet is as follows: ...
if (bind(s_, (sockaddr *)&sa, sizeof(sockaddr_in)) == SOCKET_ERROR) {
I don't know why this call chooses to call boost::bind instead of the socket bind; it may have something to do with the type of s_. Either way, you should be able to fix it by using ::bind instead of just bind. -- Peter Dimov http://www.pdplayer.com
participants (2)
-
Peter Dimov
-
Sharad Mittal