-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC-FFI-like interop when embedding into a shared library #178
Comments
I see with
|
Looks like from C I can pass an event like this: /* Emit window 'load' event. */
if (!JS_IsException(ret) && is_main) {
static char emit_window_load[] = "window.dispatchEvent(new Event('load'));";
JSValue ret1 = JS_Eval(ctx, emit_window_load, strlen(emit_window_load), "<global>", JS_EVAL_TYPE_GLOBAL);
if (JS_IsException(ret1)) {
tjs_dump_error(ctx);
}
} Now to find how to call C from JS. Most likely going to need to compile |
TBH I never considered this use case so far. The whole thing is not thread safe, so we'd need to add some new API to make is possible to call stuff from outside the thread running. |
mildly related to https://github.com/saghul/txiki.js/pull/179/files
It's pretty clear that
TJS_Run
is most likely a blocking call. That's fine. You can get around that by puttingTJS
on its own thread.My question to you is, how could the native calling code (for example a Win32 DLL in DllMain) interact with the TJS runtime? How could messages be passed to and from? Obviously you can do things like named pipes, shared memory, a queue, etc. but I'm looking if it's possible to inject events.
Is there any easy way to pass messages from the QuickJS runtime/context into native code, and back from native code into QuickJS runtime?
The text was updated successfully, but these errors were encountered: