fix(windows): add memset_explicit symbol export for mingw cross-compilation #118

Merged
sarman merged 2 commits from fix/cargo-config-sodium into beta 2026-06-19 04:39:01 +00:00
2 changed files with 9 additions and 1 deletions
Showing only changes of commit d45e767d6d - Show all commits

View File

@ -13,6 +13,8 @@ fn main() {
.file("memset_s_shim.c")
.compile("memset_shim");
println!("cargo:rerun-if-changed=memset_s_shim.c");
// Explicitly link the shim library
println!("cargo:rustc-link-lib=static=memset_shim");
}
tauri_build::build()

View File

@ -6,7 +6,13 @@
#include <string.h>
void memset_explicit(void *dest, int val, size_t n) {
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
EXPORT void memset_explicit(void *dest, int val, size_t n) {
volatile unsigned char *p = (volatile unsigned char *)dest;
while (n--) {
*p++ = (unsigned char)val;