From 4f5afcb7418e91fb8c5c13b0603c16f0873b2d70 Mon Sep 17 00:00:00 2001 From: metif12 Date: Thu, 12 Nov 2026 15:09:16 +0330 Subject: [PATCH] sokol: wrap const HWND getter for V --- vlib/sokol/c/sokol_v_post.c | 6 ++++++ vlib/sokol/c/sokol_v_post.h | 1 + vlib/sokol/sapp/sapp.c.v | 2 +- vlib/sokol/sapp/sapp_funcs.c.v | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/vlib/sokol/c/sokol_v_post.c b/vlib/sokol/c/sokol_v_post.c index 4922253251d227..1fd2c6fe646669 100644 --- a/vlib/sokol/c/sokol_v_post.c +++ b/vlib/sokol/c/sokol_v_post.c @@ -1,2 +1,8 @@ // This implementation belongs to the native owner in a cached build. #include "sokol_v.post.h" + +#if defined(SOKOL_APP_INCLUDED) && defined(SOKOL_APP_IMPL) +SOKOL_APP_API_DECL void* v_sapp_win32_get_hwnd(void) { + return (void*) sapp_win32_get_hwnd(); +} +#endif diff --git a/vlib/sokol/c/sokol_v_post.h b/vlib/sokol/c/sokol_v_post.h index 98eef6c2a3ba44..db09bdc37a5e63 100644 --- a/vlib/sokol/c/sokol_v_post.h +++ b/vlib/sokol/c/sokol_v_post.h @@ -4,6 +4,7 @@ #if defined(SOKOL_APP_INCLUDED) SOKOL_APP_API_DECL void v_sapp_get_environment(sapp_environment* out_env); SOKOL_APP_API_DECL void v_sapp_get_swapchain(sapp_swapchain* out_swapchain); +SOKOL_APP_API_DECL void* v_sapp_win32_get_hwnd(void); #endif int v_sapp_read_rgba_pixels(int x, int y, int width, int height, unsigned char* pixels); diff --git a/vlib/sokol/sapp/sapp.c.v b/vlib/sokol/sapp/sapp.c.v index 00d444f3244c2b..d3229bcd4910c9 100644 --- a/vlib/sokol/sapp/sapp.c.v +++ b/vlib/sokol/sapp/sapp.c.v @@ -273,7 +273,7 @@ pub fn ios_get_window() voidptr { // Win32: get the HWND window handle @[inline] pub fn win32_get_hwnd() voidptr { - return voidptr(C.sapp_win32_get_hwnd()) + return C.v_sapp_win32_get_hwnd() } // GL: get framebuffer object diff --git a/vlib/sokol/sapp/sapp_funcs.c.v b/vlib/sokol/sapp/sapp_funcs.c.v index 1d06953c84e628..278ade6f4d628f 100644 --- a/vlib/sokol/sapp/sapp_funcs.c.v +++ b/vlib/sokol/sapp/sapp_funcs.c.v @@ -141,7 +141,7 @@ fn C.sapp_ios_get_window() voidptr fn C.sapp_d3d11_get_swap_chain() voidptr // Win32: get the HWND window handle -fn C.sapp_win32_get_hwnd() voidptr +fn C.v_sapp_win32_get_hwnd() voidptr // GL: get major version fn C.sapp_gl_get_major_version() i32