-
I am wondering if it would be possible to wrap a native shared library (for example a .so) using kotlin native and CInterop and then call that code from JVM using Knee? I mean something like that: some native lib (.so) -> cinterop -> kotlin native -> knee -> kotlin/jvm This would greatly improve the quality of working with native libraries from multiplatform code 🙌 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you manually write wrapper functions/classes and annotate them properly, yes.
If you are writing a new application, you can strive to have as much logic as possible in the Kotlin/Native layer, and consume your |
Beta Was this translation helpful? Give feedback.
If you manually write wrapper functions/classes and annotate them properly, yes.
If you are writing a new application, you can strive to have as much logic as possible in the Kotlin/Native layer, and consume your
*.so
libraries there (no Knee needed). Then, use Knee to expose data to your UI. Basically, I would try to haveandroidMain
as small as possible, only the UI and a few helpers to access platform APIs that are missing in the NDK. Put most stuff inandroidNativeMain
(ornativeMain
, shared with iOS).