Lately I’ve been messing around a lot with cintero...
# webassembly
k
Lately I’ve been messing around a lot with cinterop and a C game development library called Raylib. It works perfectly fine on Native (almost too well) but that library can also export to wasm via emscripten. I know that with cinterop you can technically create a library even for wasm by passing -target wasm32 but is there any way to connect cinterop .klib with wasm and get a get it to work? I tried exporting bitcode and use bitcode with emscripten but it complained about “konan” bits present in it
b
Note
wasm32
target in Kotlin/Native will be deprecated in favor of the new (dedicated) Kotlin/Wasm compiler backend.
Speaking about using the library compiled by emscripten, it’s possible but could be tricky now — right now you need write glue code and required declarations manually. In the future it should be simpler.
k
Would there be any examples of that by any chance? I’ve been scavenging everywhere for something to take a look as I wish to one day get the cinterop lib not only be on native but also have ability to export to web via emscripten
b
You can dig into https://github.com/JetBrains/skiko/tree/yakovlev/wasm_experimental/ which uses Skia compiled with emscripten from Kotlin/Wasm.
k
Awesome thank you! Will take a look