Skip to content

Commit

Permalink
Windows: Fix build error incompatible pointer types
Browse files Browse the repository at this point in the history
On GitHub workflows, building the native extensions for `cool.io` fails
as follows:

    ../libev/ev.c: In function 'evpipe_write':
    ../libev/ev.c:2484:19: error: assignment to 'char *' from incompatible pointer
    type 'WSABUF *' [-Wincompatible-pointer-types]
     2484 |           buf.buf = &buf;
          |                   ^

* Runner: windows-2022 (20240421.1.0)
* Use `ruby/setup-ruby v1` to set up Ruby
  * https://github.com/actions/setup-ruby
* Dependency: `cool.io` v1.8.0

The type of `buf` member of `WSABUF` is `char *`:

* https://learn.microsoft.com/en-us/windows/win32/api/ws2def/ns-ws2def-wsabuf

On `libev` upstream, this was already fixed on v4.25:

http://cvs.schmorp.de/libev/ev.c?r1=1.484&r2=1.485&pathrev=rel-4_25

Maybe we should try to update the overall `libev` version, but that
could be difficult.
So, this commit intends to fix this error first.
  • Loading branch information
daipom committed May 13, 2024
1 parent 9fc62ce commit 55bc0c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/libev/ev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,7 @@ evpipe_write (EV_P_ EV_ATOMIC_T *flag)
#ifdef _WIN32
WSABUF buf;
DWORD sent;
buf.buf = &buf;
buf.buf = (char *)&buf;
buf.len = 1;
WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0);
#else
Expand Down

0 comments on commit 55bc0c0

Please sign in to comment.