Enable Windows MinGW support (#1000)

Allow compilation on Windows MinGW, see build_wamr.md for more details.

Note that WASI and some other smallish details are still not supported, but
we have a starting point. See more discussion at #993
This commit is contained in:
lucianoiam
2022-02-06 06:20:38 +01:00
committed by GitHub
parent 5f8c7655a7
commit 4bdeb909df
6 changed files with 57 additions and 4 deletions

View File

@ -9,7 +9,12 @@ uint64
os_time_get_boot_microsecond()
{
struct timespec ts;
#if defined(__MINGW32__)
// https://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg18361.html
clock_gettime(CLOCK_REALTIME, &ts);
#else
timespec_get(&ts, TIME_UTC);
#endif
return ((uint64)ts.tv_sec) * 1000 * 1000 + ((uint64)ts.tv_nsec) / 1000;
}

View File

@ -9,6 +9,11 @@
#endif
#if defined(_WIN32) || defined(_WIN32_)
#if defined(__MINGW32__) && !defined(_SH_DENYNO)
#define _SH_DENYNO 0x40
#endif
char *
bh_read_file_to_buffer(const char *filename, uint32 *ret_size)
{