4 ms·
> since all major languages have provisions to create C bindings. Does WebAssembly or any of its runtimes provide a way to do this?
by MuffinFlavored 7y ago
> since all major languages have provisions to create C bindings.
Does WebAssembly or any of its runtimes provide a way to do this?
- szczepano 7y agoyou can probably compile c to webassembly using clang/llvm
- derefr 7y agoThat's not what the parent was asking. They were asking if WASM has an FFI interface for runtimes that want to not execute the WASM code entirely sandboxed from the host, but rather want to allow you to dlload(2) code into the OS process hosting the WASM interpreter and call it through WASM ops. Presumably, https://github.com/CraneStation/wasmtime https://github.com/CraneStation/wasmtime would benefit from such an FFI API being specified.
- MuffinFlavored 7y agoPrecisely. Do you think this is a feature the WebAssembly team should standardize or is it a bad fit for the language?
- deleted 7y ago[deleted]
- syrusakbary 7y agoThat should be doable! (Disclaimer: I work at Wasmer https://github.com/wasmerio/wasmer https://github.com/wasmerio/wasmer )
- zbentley 7y agoThat sounds like ActiveX 2.0 at best, and an utter security nightmare at worst.
- tracker1 7y agoYes, emscripten/llvm builds C code into webassembly. I'd say a significant portion of webassembly is C/C++ sourced.
- MuffinFlavored 7y agoYou can't use emscripten/llvm with, #include <windows.h> to provide a GUI per se, can you?
- tracker1 7y agoNope. There are iirc specific bindings for that in a browser context. I think there's been a lot of work for other runtimes.
- thosakwe 7y agoGenuine question here: if you’re already going to be shipping native code, why would you need WebAssembly in the mix, especially if you’re not targeting a browser?
- funny_falcon 7y agoFor example, if you want to execute "native" code in a restricted environment. WebAssembly is quite fast when (jit)compiled. Therefore, it's very tempting to use it to embed extension logic.