-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(libc): windows native module support #490
feat(libc): windows native module support #490
Conversation
mingw it seems to be different from MSVC…… |
Yep, some if-defing might be required... |
@saghul ci is ok |
Can you make sure the relevant tests also run on Windows? IIRC they are not compiled in. |
init = (JSInitModuleFunc *)(void *)GetProcAddress(hd, "js_init_module"); | ||
if (!init) { | ||
JS_ThrowReferenceError(ctx, "js_init_module '%s' not found: %lu", | ||
module_name, GetLastError()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nicer to use FormatMessageA() to get a human-readable error message (example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis
FormatMessageA error message fetching is a bit complicated, whether to consider a separate method to get it
struct JSContext {
char* errmsg;
}
static int js_error(JSContext *ctx) {
if (ctx->errmsg) {
LocalFree(ctx->errmsg);
ctx->errmsg = NULL;
}
// FormatMessageA ……
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis Doing it The Right Way (TM) seems a bit involved: https://github.com/libuv/libuv/blob/0a00e80c3686b93eccb9a801954e86bd7d7fe6ab/src/win/dl.c#L92 perhaps we can simplify here?
Yep those will do! |
How weird, I'll take a look at that one. You can ignore it. |
I guess what's missing is to run the actual tests, check this one: quickjs/.github/workflows/ci.yml Line 137 in 0e5e9c2
|
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Not sure why that started happening, we need to take a look, but you can ignore that for this PR. |
@saghul |
@saghul job/29858936901 What is wrong with this |
Since you modified the JS part of the test, you need to commit the result of |
Yes, this is unfortunate. We should try and find a way to generate these files at build time and avoid committing them. This would also reduce bloat in the repository. |
I have the same conundrum on txiki.js, only worse, because I have a lot more generated code. I gave this a long hard thought and while we could generate it in the release job and then make a "release tarball", I'd rather have the git repo be the source of truth, specially after the xz fiasco. |
I concur with that sentiment, fwiw. |
Which of the 2? 😅 |
I am not sure I understand the connection with the xz fiasco. We shall be very cautious about accepting PRs from, let alone giving commit rights to outsiders. Generating the byte code files at build time is mainly a problem for cross compiling where it requires building a qjs executable for the host in addition to cross compiling for the selected target. This used to be problematic because the generated files depended on the endianness of the target, which is no longer the case. |
That git should be the Source Of Truth :) (I deliberated on whether to mention I was referring to your comment but, since a couple of a minutes had passed, I figured it was unambiguously in response to the last comment.) |
Let's continue here: #509 not to derail the PR. |
@zeromake There seems to be a conflict. Can you please rebase with latest master? |
@saghul is merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! @bnoordhuis can you PTAL too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some suggestions and questions.
WTF?! |
i do rollback +target_link_libraries(fib qjs)
-target_link_libraries(fib ${qjs_libs}) |
@saghul runs/10788294143 run on 3 hours ago…… |
I think our free credit is running low 😅 |
Hum I see the failure again. I think it might be the JS_EXTERN change. Can you undo that and let's check again? |
Looking at what we do in libuv:
I think we should undo the JS_EXTERN change and likely do something like the above later on. |
@bnoordhuis I'll make some follow-up refinements since I'm playing around with the linking libraries in another PR. |
Nice work @zeromake ! 👏 |
by #486
add definde
QJS_NATIVE_MODULE_SUFFIX
, windows is.dll
, !windows is.so
.