From be5f14a17085b766d34320b2a66aac794239f658 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 17 May 2026 08:39:35 +0300 Subject: [PATCH] sokol: add const_ prefix to C interop params to match header signatures TCC is strict about const qualifier mismatches in redeclarations. Without the const_ prefix, V generates forward declarations without const, which conflicts with the actual sokol header declarations. --- vlib/sokol/audio/audio.c.v | 4 ++-- vlib/sokol/sapp/sapp_funcs.c.v | 4 ++-- vlib/sokol/sfons/sfons_funcs.c.v | 2 +- vlib/sokol/sgl/sgl_funcs.c.v | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vlib/sokol/audio/audio.c.v b/vlib/sokol/audio/audio.c.v index 556b1547a..9ec05d7d3 100644 --- a/vlib/sokol/audio/audio.c.v +++ b/vlib/sokol/audio/audio.c.v @@ -103,7 +103,7 @@ pub mut: logger C.saudio_logger } -fn C.saudio_setup(desc &C.saudio_desc) +fn C.saudio_setup(const_desc &C.saudio_desc) fn C.saudio_shutdown() @@ -123,7 +123,7 @@ fn C.saudio_suspended() bool fn C.saudio_expect() i32 -fn C.saudio_push(frames &f32, num_frames i32) i32 +fn C.saudio_push(const_frames &f32, num_frames i32) i32 // setup - setup sokol-audio pub fn setup(desc &C.saudio_desc) { diff --git a/vlib/sokol/sapp/sapp_funcs.c.v b/vlib/sokol/sapp/sapp_funcs.c.v index defec5baa..5c6752c31 100644 --- a/vlib/sokol/sapp/sapp_funcs.c.v +++ b/vlib/sokol/sapp/sapp_funcs.c.v @@ -98,7 +98,7 @@ fn C.sapp_get_clipboard_string() &char fn C.sapp_set_window_title(&char) // set the window icon (only on Windows and Linux) -fn C.sapp_set_icon(icon_desc &IconDesc) +fn C.sapp_set_icon(const_icon_desc &IconDesc) // Get number of dropped files fn C.sapp_get_num_dropped_files() i32 @@ -107,7 +107,7 @@ fn C.sapp_get_num_dropped_files() i32 fn C.sapp_get_dropped_file_path(i32) &char // special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub) -fn C.sapp_run(desc &Desc) i32 +fn C.sapp_run(const_desc &Desc) i32 // get runtime environment information fn C.sapp_get_environment() Environment diff --git a/vlib/sokol/sfons/sfons_funcs.c.v b/vlib/sokol/sfons/sfons_funcs.c.v index 18059764e..5d0c1c721 100644 --- a/vlib/sokol/sfons/sfons_funcs.c.v +++ b/vlib/sokol/sfons/sfons_funcs.c.v @@ -19,7 +19,7 @@ pub: allocator C.sfons_allocator_t // optional memory allocation overrides } -fn C.sfons_create(desc &C.sfons_desc_t) &fontstash.Context +fn C.sfons_create(const_desc &C.sfons_desc_t) &fontstash.Context fn C.sfons_destroy(ctx &fontstash.Context) fn C.sfons_flush(ctx &fontstash.Context) diff --git a/vlib/sokol/sgl/sgl_funcs.c.v b/vlib/sokol/sgl/sgl_funcs.c.v index 256d6ceca..c29b36146 100644 --- a/vlib/sokol/sgl/sgl_funcs.c.v +++ b/vlib/sokol/sgl/sgl_funcs.c.v @@ -1,7 +1,7 @@ module sgl // setup/shutdown/misc -fn C.sgl_setup(desc &C.sgl_desc_t) +fn C.sgl_setup(const_desc &C.sgl_desc_t) fn C.sgl_shutdown() fn C.sgl_error() SglError fn C.sgl_context_error(ctx C.sgl_context) SglError @@ -9,15 +9,15 @@ fn C.sgl_rad(deg f32) f32 fn C.sgl_deg(rad f32) f32 // context functions -fn C.sgl_make_context(desc &C.sgl_context_desc_t) C.sgl_context +fn C.sgl_make_context(const_desc &C.sgl_context_desc_t) C.sgl_context fn C.sgl_destroy_context(ctx C.sgl_context) fn C.sgl_set_context(ctx C.sgl_context) fn C.sgl_get_context() C.sgl_context fn C.sgl_default_context() C.sgl_context // create and destroy pipeline objects -fn C.sgl_make_pipeline(desc &C.sg_pipeline_desc) C.sgl_pipeline -fn C.sgl_context_make_pipeline(ctx C.sgl_context, desc &C.sg_pipeline_desc) C.sgl_pipeline +fn C.sgl_make_pipeline(const_desc &C.sg_pipeline_desc) C.sgl_pipeline +fn C.sgl_context_make_pipeline(ctx C.sgl_context, const_desc &C.sg_pipeline_desc) C.sgl_pipeline fn C.sgl_destroy_pipeline(pip C.sgl_pipeline) // render state functions -- 2.39.5