mirror of
https://github.com/ares-emulator/ares.git
synced 2026-10-12 02:11:04 +00:00
Begin the process of splitting nall into separate translation units. It can now be used in two ways: 1) as a header-only library by defining NALL_HEADER_ONLY 2) by compiling nall/nall.cpp sourcery has been updated to demonstrate the header-only use and everything else now builds nall.cpp. So far the only things moved into .cpp files are implementations that call Windows APIs. This allows most of ares to build without including windows.h and enables the removal of the abomination that was windows/guard.hpp. The things that actually need windows.h (hiro, ruby) must avoid using names reserved by Windows headers, but the rest of ares is free to use names like "far", "boolean", and "interface" with reckless abandon. This work is done in preparation for building against MSVC and Windows SDK headers/libraries an an alternative to MinGW-w64.
26 lines
778 B
C++
26 lines
778 B
C++
#include <nall/platform.hpp>
|
|
|
|
#if defined(PLATFORM_WINDOWS)
|
|
|
|
#include <winsock2.h>
|
|
|
|
NALL_HEADER_INLINE auto poll(struct pollfd fds[], unsigned long nfds, int timeout) -> int { return WSAPoll(fds, nfds, timeout); }
|
|
|
|
namespace nall {
|
|
|
|
NALL_HEADER_INLINE auto recv(int socket, void* buffer, size_t length, int flags) -> ssize_t {
|
|
return ::recv(socket, (char*)buffer, length, flags);
|
|
}
|
|
|
|
NALL_HEADER_INLINE auto send(int socket, const void* buffer, size_t length, int flags) -> ssize_t {
|
|
return ::send(socket, (const char*)buffer, length, flags);
|
|
}
|
|
|
|
NALL_HEADER_INLINE auto setsockopt(int socket, int level, int option_name, const void* option_value, int option_len) -> int {
|
|
return ::setsockopt(socket, level, option_name, (const char*)option_value, option_len);
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|