On Sat, Apr 25, 2020 at 10:51 PM Tianqi Chen <[email protected]> wrote:
> I see. I wonder if it is possible to get some middle ground. > > // mod is emscripten module > mod =Module; > > wasmInstance = mod.wasmInstance; > wasmMemory = wasmInstance.exports.memory > > // Directly interact with wasmInstance > // using the WebAssembly API > // syscall callbacks can trap into emscripten module > I think that should work yes. I don't see anything stopping you doing that today. > TQ > On Thu, Apr 23, 2020 at 7:21 PM 'Sam Clegg' via emscripten-discuss < > [email protected]> wrote: > >> >> On Wed, Apr 22, 2020 at 9:29 PM Tianqi Chen <[email protected]> >> wrote: >> >>> Dear Developers: >>> >>> https://v8.dev/blog/emscripten-standalone-wasm provides an excellent >>> description about how to compile a stand-alone WASM via emcc. >>> However, in the case of the syscalls still needs emscripten defined >>> files, we will still need an emscripten generated file, and that means >>> we will need to interact with the WASM via the emscripten Javascript >>> wrapper, e.g. Module.wrap, and call >>> >>> Recently we start to look into directly build our js interface on top of >>> the WASM js API. >>> I am wondering if it is possible to directly interact with the wasm >>> module generated by emscripten via the standard WASM js interface, >>> but still make these additional emscripten syscalls available. >>> >>> In particular, I am looking for something like >>> >>> >>> emcc -O3 mylib.c -o mylib.js -s STANDALONE_WASM >>> >>> >>> Then >>> >>> const binary = require('fs').readFileSync('mylib.wasm'); >>> >>> // this line ontains the emscripten defined syscalls as a imports >>> // that can be passed to the WebAssembly interface. >>> imports_with_emscripten_sycalls = getEnv("mylib.js"); >>> >>> WebAssembly.instantiate(binary, imports_with_emscripten_sycalls); >>> >>> >>> >> No, this is currently not possible. I think it would be cool feature >> though. I'm not sure how much work it would be to modify the generated JS >> to work in this way. I'm guessing a fair amount.. >> >> >> >>> Thank you! >>> >>> TQ >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/emscripten-discuss/4dda2146-9bb7-4d5e-abc9-adeb505ef029%40googlegroups.com >>> <https://groups.google.com/d/msgid/emscripten-discuss/4dda2146-9bb7-4d5e-abc9-adeb505ef029%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "emscripten-discuss" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/emscripten-discuss/Dqdcjzs6fj0/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/CAL_va29AAMY5-CQ5S7gYQ6MD1Bp3Y5hpBYrMNFc14w3zh3V8hw%40mail.gmail.com >> <https://groups.google.com/d/msgid/emscripten-discuss/CAL_va29AAMY5-CQ5S7gYQ6MD1Bp3Y5hpBYrMNFc14w3zh3V8hw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/CANBSEKFBy-o124Q_h-hkgwK6w1yZOGcWnrar_SM-e8UZ%3DmLyQQ%40mail.gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/CANBSEKFBy-o124Q_h-hkgwK6w1yZOGcWnrar_SM-e8UZ%3DmLyQQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-3eLsPCVvX00p8thgtUdKYiJ-giBy6NgOJZV9p86UyFw%40mail.gmail.com.
