Hi all I have got an app on both Android and iOS which integrates native c/c++ library, I am very much excited to migrate to Kotlin Multiplatform, just wanted to know how to have this integration with Kotlin Multiplatform and also are there any other challenges I need to be aware of before making my decision
e
ephemient
08/29/2023, 9:35 AM
Kotlin/Native cinterop and Android/Java JNI work very differently and there isn't anything to help you maintain consistency in a multiplatform project now, unfortunately
ephemient
08/29/2023, 9:36 AM
you can write
expect
in common code, with separate
actual
implementations on Android and iOS
👍 1
n
Nandu
08/29/2023, 9:37 AM
Will give a try with this first before making a decision, this is crucial for me
Yeah, work in progress still! not for production any time soon 🙃
But current
main
branch more or less shows on how to make it possible to write common code
BUT, be aware, that Im researching there GENERAL approach. If you just need to wrap some functions it will be much more easier 🙂
Some time ago, I created another repository (https://github.com/whyoleg/kotlin-interop-playground) where I would to collect some different currently possible ways to integrate native code in different platforms
If I will find time, I could try to setup some minimal, simple to check sample for native code sharing in android and iOS with common code - of course if it will be helpful