From 788128aec79dfa9b7e3eb2a0784e0fdf6538d448 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 13 Jan 2025 13:04:19 +0100 Subject: [PATCH] Fix `-Wpointer-type-mismatch` warning (GH-17453) `GetProcAddress()` returns a `FARPROC` (aka. `long long (*)()`) which is not compatible with `void *` per the specs. However, on Windows they are, so we silence the warning with a cast. --- ext/ffi/ffi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 99abce53785..c8e0035b3ac 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -3052,7 +3052,7 @@ static void *dlsym_loaded(char *symbol) return addr; } # undef DL_FETCH_SYMBOL -# define DL_FETCH_SYMBOL(h, s) (h == NULL ? dlsym_loaded(s) : GetProcAddress(h, s)) +# define DL_FETCH_SYMBOL(h, s) (h == NULL ? dlsym_loaded(s) : (void*) GetProcAddress(h, s)) #endif ZEND_METHOD(FFI, cdef) /* {{{ */