Skip to content

Can I wrap .so library in kotlin native and call it from JVM using Knee? #6

Answered by natario1
lemcoder asked this question in Q&A
Discussion options

You must be logged in to vote

If you manually write wrapper functions/classes and annotate them properly, yes.

This would greatly improve the quality of working with native libraries from multiplatform code 🙌

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 have androidMain as small as possible, only the UI and a few helpers to access platform APIs that are missing in the NDK. Put most stuff in androidNativeMain (or nativeMain, shared with iOS).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@adamglin0
Comment options

@natario1
Comment options

Answer selected by lemcoder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants