From 5058c94d570e5a4db23414cee8bc07f7363372e6 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 16 Oct 2025 14:55:23 +0900 Subject: [PATCH] hal-win-io: fix windows compilation errors add missing headers (direct.h for _getcwd, stdint.h for intptr_t) and fix handle/int pointer truncation warnings by casting through intptr_t. handles are 64-bit pointers on x64 windows but the hal interface uses int for pid, requiring intermediate cast to suppress warnings. Co-authored-by: Claude --- mrbgems/hal-win-io/src/io_hal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mrbgems/hal-win-io/src/io_hal.c b/mrbgems/hal-win-io/src/io_hal.c index 94ebce3c2..f4220434f 100644 --- a/mrbgems/hal-win-io/src/io_hal.c +++ b/mrbgems/hal-win-io/src/io_hal.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include /* Maximum path length */ #ifndef PATH_MAX @@ -510,7 +512,7 @@ mrb_hal_io_spawn_process(mrb_state *mrb, const char *cmd, CloseHandle(pi.hThread); /* Store process handle as PID (will be used in waitpid) */ - *pid = (int)pi.hProcess; + *pid = (int)(intptr_t)pi.hProcess; return 0; } @@ -518,7 +520,7 @@ mrb_hal_io_spawn_process(mrb_state *mrb, const char *cmd, int mrb_hal_io_waitpid(mrb_state *mrb, int pid, int *status, int options) { - HANDLE h = (HANDLE)pid; + HANDLE h = (HANDLE)(intptr_t)pid; DWORD wait_result; DWORD exit_code; DWORD timeout;