4 ms·
Maybe a good place to ask this question: I recently wanted to share lib code between three separate codebases (JavaScript, Swift and Kotlin). I considered writi
by ghayes 3y ago
Maybe a good place to ask this question: I recently wanted to share lib code between three separate codebases (JavaScript, Swift and Kotlin). I considered writing it in a wasm-compatible language and sharing it as a wasn module. Curious if wasmer may cover these use-cases, since a) it’s cool to share code, but b) building high-quality native wrappers is hard (e.g. to wrap complex data types when different languages may have preferred styles).
- idorosen 3y agoAll three languages have C FFI support of some kind. You could write it in C or C++ with some generated (or manual) wrappers/shims.
- jillesvangurp 3y agoYour best bet for this right now would be kotlin multiplatform, which can target IOS native, browsers, and of course android. It also has an experimental wasm compiler but it's not ready for production usage. But you could actually target wasm with it. Embedding WASM on IOS might be problematic because of Apple's rules regarding what is and isn't acceptable there. They've never liked people embedding interpreters in their apps. That's how they blocked flash as well. And that's how they continue to block the firefox and chrome browser engines.
- jamil7 3y agoRust and UniFFI would cover the native side, although async/futures support is immature currently. You could then also potentially compile to wasm but I haven’t tried that.
- IshKebab 3y agoYou want something like this: https://extism.org/ https://extism.org/ I haven't got around to actually trying it yet though.