4ntoine
05/16/2019, 5:34 AMjava.security
to be more detailed) from Kotlin code that is compiled with Kotlin/Native into binary (shared library used on android). Any suggestions on how i can achieve it? In regular java code i had to write JNI glue code for this i guess, wondering if i can achieve it more in more elegant way with Kotlingildor
05/16/2019, 5:55 AMTobi
05/16/2019, 6:35 AMgildor
05/16/2019, 6:37 AMgildor
05/16/2019, 6:37 AMgildor
05/16/2019, 6:40 AM4ntoine
05/16/2019, 6:41 AMgildor
05/16/2019, 6:42 AMgildor
05/16/2019, 6:42 AMgildor
05/16/2019, 6:42 AM4ntoine
05/16/2019, 6:43 AMexpect/actual
approach. If we mark that expected class with some custom annotation like @JavaFromNative
it (new required interop tool) can generate that JNI glue code file that calls java impl from native impl. The interfaces are 100% compatible. Afraid it can work for primitive types only, but anywaygildor
05/16/2019, 6:44 AM4ntoine
05/16/2019, 6:45 AM4ntoine
05/16/2019, 6:46 AMgildor
05/16/2019, 6:47 AM4ntoine
05/16/2019, 6:47 AMgildor
05/16/2019, 6:47 AMgildor
05/16/2019, 6:47 AM4ntoine
05/16/2019, 6:48 AMgildor
05/16/2019, 6:48 AMgildor
05/16/2019, 6:50 AMgildor
05/16/2019, 6:51 AM4ntoine
05/16/2019, 6:52 AMArrayList
seems to be available in both /jvm and /native, right?4ntoine
05/16/2019, 6:52 AMgildor
05/16/2019, 6:52 AMgildor
05/16/2019, 6:53 AMTobi
05/16/2019, 6:53 AM4ntoine
05/16/2019, 6:53 AMgildor
05/16/2019, 6:54 AM4ntoine
05/16/2019, 6:55 AM4ntoine
05/16/2019, 6:55 AM4ntoine
05/16/2019, 6:56 AMgildor
05/16/2019, 6:56 AM4ntoine
05/16/2019, 6:58 AMgildor
05/16/2019, 6:59 AM4ntoine
05/16/2019, 7:01 AMgildor
05/16/2019, 7:03 AM4ntoine
05/16/2019, 7:04 AM4ntoine
05/16/2019, 7:05 AMgildor
05/16/2019, 7:06 AMgildor
05/16/2019, 7:06 AMgildor
05/16/2019, 7:06 AM4ntoine
05/16/2019, 7:29 AMsvyatoslav.scherbina
05/16/2019, 7:36 AMgildor
05/16/2019, 7:37 AMgildor
05/16/2019, 7:40 AM4ntoine
05/16/2019, 7:41 AMgildor
05/16/2019, 7:51 AMWhy do you need to mix Kotlin/Native and Kotlin/JVM in the same applicationOne more thing, even if most of your application is Native, it’s hard to do everything on native side, you have very limited access to Android API from native, so you still want to use Android SDK APIs (just to configure application, launch native part, control notifications, get access to application properties etc) and for this you need JVM language and good interop would be very helpful
svyatoslav.scherbina
05/16/2019, 9:37 AMusage of native heapSo you need a fancy wrapper for
sun.misc.Unsafe
here.
usage of other native librariesSupport for using C libraries in Kotlin/JVM would be enough for this.
There are apps [large and old] that are mostly written in C++. So usually they are compiled as huge shared libs wrapped into android code and platform UI added on the top. Eg. Chromium, games, etc. Some Photoshops, CADs, image/sound editors come into my mind too, It’s not rare case btw - most performance-critical or low-level hardware apps with legacy code are written that wayWhat makes you think that Kotlin/Native should suitable for this?
gildor
05/16/2019, 9:38 AMSo you need a fancy wrapper forNot reallyhere.sun.misc.Unsafe
gildor
05/16/2019, 9:38 AMSupport for using C libraries in Kotlin/JVM would be enough for this.Yes, it one of the options, but isn’t K/N is better candidate for this? And interop between Kotlin looks as better than write completely new C interop for JVM, but I’m not sure
svyatoslav.scherbina
05/16/2019, 9:44 AMNot reallyWhy so?
And interop between Kotlin looksthe hardest solution for this problem.
completely new C interop for JVMIs internally available from the very beginning of Kotlin/Native project.
gildor
05/16/2019, 9:51 AM4ntoine
05/16/2019, 8:34 PM4ntoine
05/17/2019, 6:50 AMsvyatoslav.scherbina
05/17/2019, 7:20 AMHowever in this case we still have to access java.security.* so we need bridgingWhy not use an equivalent native library?
4ntoine
05/17/2019, 7:43 AM