Hey everyone. I'm having some problems:
Code:
(in Socket class definition)
int Socket::recv(char* buf, int len);
(in separate .cpp)
int Socket::recv(char* buf, int len)
{
assert(buf != NULL);
return ::recv(si->desc, buf, len, 0);
}
The above code compiles properly, but if I add the keyword inline to either the prototype or definition, I end up with an unresolved external pertaining to "int __thiscall Socket::recv(char *,int)". However, if I simply 'inline' the function by putting the definition in the class definition and eliminating the prototype, then I have no errors. The only place Socket::recv() is being called, is here:
Code:
void readCallback(Socket s, int err)
{
char buf[200];
int res = s.recv(buf, 200);
if(res == SOCKET_ERROR)
MERR("Receive err");
else
buf[res] = '\0';
log << buf << std::endl;
}
If it makes any difference, readCallback() is being called via a function pointer contained within the Socket object being passed to it.
Is this a compiler bug (happens both with MSVC 2005 Express Beta 2 and MSVC 6.0 Pro), or is there something I'm doing genuinely wrong?