Hi, I'm interested in using wit-bindgen to create libraries written in Rust that will be used by mobile hosts (iOS/Swift, Android/Kotlin), the readme suggested checking in here before diving in.
I see Java is already supported but:
1) Has there been any work on generating Swift code and using this on iOS hosts?
2) Are there any know major barriers to getting this working?
3) How far away is some kind of async function support from landing?
If not I would like to contribute Swift support if there is interest.
Thanks
Hey! Thanks for asking and welcome to contribute Swift guest bindgen!
Also, wasmtime won't work on iOS anyway due to JIT restrictions on that platform.
@Mossaka (Joe) Thanks for the quick reply. I'm looking for Swift host support, my use case is to have the guest written in rust which from what I understand is very well supported. My plan was to wrap the wasmtime C API (https://docs.wasmtime.dev/c-api/) with Swift as a first step, then work on adding Swift code generation.
@Joel Dice Doesn't wasmtime support an AOT compilation mode? Would that not work on iOS?
Ah that makes sense! Currently all the host generations are moved out of wit-bindgen
. You might want to ask this question in the wasmtime
stream!
@Jack Qi Yes, you can have wasmtime AOT a .wasm file to a native .cwasm file, but the iOS restrictions mean that you can't execute native code that was previously writable, so you can't just download a .cwasm and run it. If you don't need to do that, and all your .cwasm files are bundled, read-only, as part of your app, then it might work. Worth a try, anyway!
@Jack Qi you might be interested in the wasmtime-py
embedding support which is a Python wrapper for Wasmtime's C API which then additionally has a bindgen
module which is a code generator to execute components in Python, essentially host support for components in Python
@Mossaka (Joe) thanks for the pointer, I'll take a look at the wasmtime
repo to see how host support is implemented for other host languages. :+1:
@Joel Dice yes I was hoping to be able bundle the AOT compiled wasm in the app and ship that. I still have hope that Apple might eventually remove the restriction in the future.
@Alex Crichton thanks I will take a look at wasmtime-py
:thumbs_up:
Last updated: Dec 23 2024 at 12:05 UTC