From c7cd9d8be644e674ad646ac0be17e8e53729940c Mon Sep 17 00:00:00 2001 From: Jim Posen Date: Thu, 9 Dec 2021 16:07:07 -0500 Subject: [PATCH] Make error constants const (#292) * Make error constants const Rust bindgen which automatically generates bindings can now identify this as const static data and produce a signature with the correct mutability. * Make error definition const too --- source/wasm3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/wasm3.h b/source/wasm3.h index 1cab94a..3867061 100644 --- a/source/wasm3.h +++ b/source/wasm3.h @@ -110,9 +110,9 @@ M3ImportContext, * IM3ImportContext; // ------------------------------------------------------------------------------------------------------------------------------- # if defined(M3_IMPLEMENT_ERROR_STRINGS) -# define d_m3ErrorConst(LABEL, STRING) M3Result m3Err_##LABEL = { STRING }; +# define d_m3ErrorConst(LABEL, STRING) extern const M3Result m3Err_##LABEL = { STRING }; # else -# define d_m3ErrorConst(LABEL, STRING) extern M3Result m3Err_##LABEL; +# define d_m3ErrorConst(LABEL, STRING) extern const M3Result m3Err_##LABEL; # endif // -------------------------------------------------------------------------------------------------------------------------------