There is already a way to remove dependencies on windows.h/winsock2.h. Just #define NO_OS_DEPENDENCE in your project/make file or in config.h.
Any chance this could be split into two or more sub-enablers? Specifically, I have my own socket handling and would like to disable those parts of the OS specific support, but I would like to keep the OSRNG support. So, if I could leave NO_OS_DEPENDENCE undefined and define NO_OS_SOCKETS or something to just disable that part I would be happy. It doesn't seem to be presenting a problem since the linker is probably removing the code anyway, but as we've seen in the past, that can be a costly assumption. I'm advocating compartmentalizing the OS features into logical groups and giving users of the lib control over which groups are available (where possible).
An example of the definitions in config.h would look like:
// define this if you want to disable all OS-dependent features, // such as sockets and OS-provided random number generators // #define NO_OS_DEPENDENCE
#ifndef NO_OS_DEPENDENCE
// define this if you want to disable OS-dependent socket support,
// #define NO_OS_SOCKETS
// define this if you want to disable OS-provided random number generators
// #define NO_OS_RNG
#else
// always defined (this part might actually be in specific headers to each logical group)
#define NO_OS_SOCKETS
#define NO_OS_RNG
#endif
Just a suggestion.
michael
