Enable libc-wasi for windows msvc build (#3852)

The default iwasm building in Windows MSVC enables libc-uvwasi because
libc-wasi isn't supported at the beginning. Since libc-wasi had been refactored
and is supported in Windows msys2 building, and libc-wasi supports more
functionalities(e.g. sockets) than libc-uvwasi, this PR fixes some issues to
enable libc-wasi in windows MSVC buidlings.
This commit is contained in:
Wenyong Huang
2024-10-14 09:52:25 +08:00
committed by GitHub
parent 36d438051e
commit b16b6044ee
8 changed files with 96 additions and 28 deletions

View File

@ -6,6 +6,12 @@
#ifndef _PLATFORM_INTERNAL_H
#define _PLATFORM_INTERNAL_H
/*
* Suppress the noisy warnings:
* winbase.h: warning C5105: macro expansion producing 'defined' has
* undefined behavior
*/
#pragma warning(disable : 5105)
#include <inttypes.h>
#include <stdbool.h>
#include <assert.h>

View File

@ -10,6 +10,10 @@
#define NANOSECONDS_PER_SECOND 1000000000ULL
#define NANOSECONDS_PER_TICK 100
extern NTSTATUS
NtQueryTimerResolution(PULONG MinimumResolution, PULONG MaximumResolution,
PULONG CurrentResolution);
static __wasi_errno_t
calculate_monotonic_clock_frequency(uint64 *out_frequency)
{
@ -140,4 +144,4 @@ os_clock_time_get(__wasi_clockid_t clock_id, __wasi_timestamp_t precision,
default:
return __WASI_EINVAL;
}
}
}

View File

@ -7,7 +7,13 @@
#define _WIN_UTIL_H
#include "platform_wasi_types.h"
#include "windows.h"
/*
* Suppress the noisy warnings:
* winbase.h: warning C5105: macro expansion producing 'defined' has
* undefined behavior
*/
#pragma warning(disable : 5105)
#include <windows.h>
__wasi_timestamp_t
convert_filetime_to_wasi_timestamp(LPFILETIME filetime);
@ -23,4 +29,4 @@ convert_windows_error_code(DWORD windows_error_code);
__wasi_errno_t
convert_winsock_error_code(int error_code);
#endif /* end of _WIN_UTIL_H */
#endif /* end of _WIN_UTIL_H */