Is there already any kind of C interoperability? W...
# webassembly
m
Is there already any kind of C interoperability? What I mean is taking some piece of C code, compile it to WASM and then call this code from Kotlin on the wasmJs target.
s
Not really. Technically, you can do it, but it is not pretty. Compose for Web already calls to C++ skia library compiled to Wasm, and calling to C wouldn’t be any harder. It involves manual linking and manual work with raw C++ memory. Hopefully, Component Model will cover most of the use-cases of calling any language library. You would need to wrap it with a component interface (if it isn’t done already).
🙏 3
m
How far away are we from having Component Model support for WASM in the browser?
a
I don't think Component model has even hit phase 4 already, has it?
Also, Component model is being implemented in Wasi, unsure how that will come to browser
s
We already have a transpiler from components to core wasm: https://github.com/bytecodealliance/jco, but its support for WasmGC is in-progress. I not sure, but would guesstimate it to be done “in a few months”. Component model designers estimate native browsers implementation as: > […] at least a year or two out (before browser implementations start) in the best case […]
🙏 1
I don’t think Component model has even hit phase 4 already, has it?
It is in Phase 1, but would likely be usabe before Phase 4, using transpilers and polyfills.
a
the link to estimate you provided has a very interesting discussion... Must read for sure