Skip to content

Commit 6ad5d28

Browse files
committed
FIX: Fix Windows C++ build
1 parent 326c92f commit 6ad5d28

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## 0.53.0 - 2026-04-07
3+
## 0.53.0 - 2026-04-08
44

55
### Enhancements
66
- Added `TryNextRecord` and `FillBuffer` to `LiveBlocking` for more fine-grained

src/detail/tcp_client.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ int Poll(::pollfd* fds, std::uint32_t nfds, int timeout_ms) {
4141
#endif
4242
}
4343

44+
int GetSockOpt(databento::detail::Socket fd, int level, int optname, int* optval) {
45+
#ifdef _WIN32
46+
int len = sizeof(*optval);
47+
return ::getsockopt(fd, level, optname, reinterpret_cast<char*>(optval), &len);
48+
#else
49+
socklen_t len = sizeof(*optval);
50+
return ::getsockopt(fd, level, optname, optval, &len);
51+
#endif
52+
}
53+
4454
#ifdef _WIN32
4555
constexpr int kConnectInProgress = WSAEWOULDBLOCK;
4656
#else
@@ -189,8 +199,7 @@ databento::detail::ScopedFd TcpClient::InitSocket(ILogReceiver* log_receiver,
189199
const int poll_ret = Poll(&pfd, 1, timeout_ms);
190200
if (poll_ret > 0) {
191201
int so_error = 0;
192-
socklen_t len = sizeof(so_error);
193-
::getsockopt(scoped_fd.Get(), SOL_SOCKET, SO_ERROR, &so_error, &len);
202+
GetSockOpt(scoped_fd.Get(), SOL_SOCKET, SO_ERROR, &so_error);
194203
connected = (so_error == 0);
195204
if (!connected) {
196205
errno = so_error;

0 commit comments

Comments
 (0)