Allow the use of native modules when using MinGW.

This commit is contained in:
DenisBelmondo 2024-06-17 22:13:13 -06:00
parent 2519e1a516
commit 4be286cfb2
4 changed files with 15 additions and 2 deletions

View file

@ -129,6 +129,8 @@ project "qjsc"
files {
"qjsc.c"
}
filter { "action:gmake*", "toolset:gcc" }
links { "dl", "pthread" }
-----------------------------------------------------------------------------------------------------------------------
@ -144,6 +146,8 @@ project "qjs"
"qjscalc.js",
"qjscalc.c"
}
filter { "action:gmake*", "toolset:gcc" }
links { "dl", "pthread" }
-- Compile repl.js and save bytecode into repl.c
prebuildcommands { "\"%{cfg.buildtarget.directory}/qjsc.exe\" -c -o \"../../repl.c\" -m \"../../repl.js\"" }

4
qjsc.c
View file

@ -32,7 +32,11 @@
#include <sys/wait.h>
#include <unistd.h>
#else
#if !defined(__MINGW32__)
#include "win/getopt.h"
#else
#include <unistd.h>
#endif
#endif
#include "cutils.h"

View file

@ -35,6 +35,9 @@
#include <limits.h>
#include <sys/stat.h>
#if defined(_WIN32)
#if defined(__MINGW32__)
#include <dlfcn.h>
#endif
#include <windows.h>
#include <conio.h>
#include <io.h>
@ -463,7 +466,7 @@ typedef JSModuleDef *(JSInitModuleFunc)(JSContext *ctx,
const char *module_name);
#if defined(_WIN32)
#if defined(_MSC_VER)
static JSModuleDef *js_module_loader_so(JSContext *ctx,
const char *module_name)
{

View file

@ -31,7 +31,9 @@
#include <time.h>
#include <fenv.h>
#include <math.h>
#if defined(__APPLE__)
#if defined(_WIN32)
#include <timezoneapi.h>
#elif defined(__APPLE__)
#include <malloc/malloc.h>
#include <sys/time.h>
#elif defined(__linux__)