Some checks failed
Test / frontend-typecheck (pull_request) Successful in 1m57s
Test / rust-clippy (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Successful in 1m46s
PR Review Automation / review (pull_request) Successful in 4m30s
Test / rust-tests (pull_request) Has been cancelled
- Add __declspec(dllexport) to memset_explicit in memset_s_shim.c - Explicitly link memset_shim library in build.rs for Windows MinGW target - Fixes undefined reference to memset_explicit when building for x86_64-pc-windows-gnu
21 lines
475 B
C
21 lines
475 B
C
/* memset_explicit shim for Windows MinGW
|
|
*
|
|
* libsodium-sys-stable expects memset_explicit which isn't available
|
|
* in the MinGW runtime. This provides a compatible implementation.
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#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;
|
|
}
|
|
}
|