Ok so I'm learning to program for multiple platforms and I saw that lots of includes/libraries use Macros to tell the compiler which functions to call on specific platforms.
So I went ahead and defined the following:
#if defined _WIN32 || defined _WIN64
#define Close(Handle) CloseHandle(Handle)
#else
#define Close(Handle) close(Handle)
#endif
But then my Socket class has the following member function:
Socket::Close()
{
//Close socket and clean up..
}
When I do the following:
Socket sock(Port, LocalHost);
sock.Close();
I get:
error: 'class Socket' has no member named 'CloseHandle'
#define Close(Handle) CloseHandle(Handle)
^
note: in expansion of macro 'Close'
sock.Close();
^
Any ideas how I can fix it or should I just get rid of the Close and make it a typedef?