https://kotlinlang.org logo
Title
b

benny.huo

01/10/2018, 12:46 PM
Waiting for interop for jvm. 😁
3
m

msink

01/10/2018, 12:56 PM
Why not just use Kotlin/JVM? What is use-case?
g

gildor

01/10/2018, 1:04 PM
To replace JNI. Actually not sure what it should be. Some compiler plugin for Kotlin/JVM or some Kotlin/Native and Kotlin/JVM interop
m

msink

01/10/2018, 1:11 PM
So it's really not "interop with jvm" but "interop jvm and c"?
cinterop -flavor=jvm
o

olonho

01/10/2018, 1:15 PM
yes, Mike is right, we do have (although do not support) Kotlin/JVM -> C interop for internal purposes
b

benny.huo

01/10/2018, 1:17 PM
After hours of searching, I still don’t know how to use “cinterop -flavor=jvm”… I just want to use Kotlin to replace Java on Jvm part and c/c++ on native part.
g

gildor

01/10/2018, 1:19 PM
There are two similar, but not exactly the same cases: JVM interop with C JVM interop with Kotlin/Native They are interchangeable sometimes but would be nice to have both
Maybe, to have both as the same interop system Actually, for us most important to have C, but we plan to have also K/N components in the future, so seamless interop with K/N from JVM would be good too (even on level of common modules for example, without exposing of native types or APIs)
b

benny.huo

01/10/2018, 1:23 PM
Agreed.
l

louiscad

01/10/2018, 1:34 PM
I think opening Kotlin/JVM <-> C & Kotlin/Native interop should be done as an experimental feature in future stages of Kotlin/Native so the Kotlin team can get feedback on the first interop design, and break things under experimental status if redesign/changes are needed
3
👏 2
g

gildor

01/10/2018, 1:42 PM
Would happy to test such experimental feature with our project
2
o

olonho

01/10/2018, 2:35 PM
Technically, nothing prevents you from using Kotlin/JVM -> C interop right away, it is not closed in any way.
l

louiscad

01/10/2018, 4:21 PM
I'm just not skilled enough to figure it out at the moment
n

napperley

01/11/2018, 12:11 AM
Next best thing would be having serialisation/message passing in a static API style between Kotlin JVM, Kotlin Native, and Kotlin JS. 😀
g

gildor

01/12/2018, 1:59 AM
I just want to add some general comment about Kotlin JVM and Native interoperability. I understand that K/N not intended to fix JNI problem, but I think it would be a really good starting point for K/N, same way as interop with Java have been a good starting point for Kotlin JVM. For example in our case most of app code is Kotlin/JVM, but we have a big native part on C/C++ because of performance (realtime audio processing) and to share code with iOS and (probably in future) Web. And JNI support is really tedious and unnatural. But! If we would have good interop Kotlin/JVM to Kotlin/Native or direct interop to C using K/N tools (like -flavor=jvm) we would be happy to use it instead of JNI and it will give us a good opportunity to adopt K/N for our native layer and not only for interop, but also as good option to share code for all our platforms and as replacement for C/C++ for some not performant critical parts (for example we have a lot of Json work in native and would happy to use Kotinx.Serialization or just Kotlin for such code). I’m not a native guy, but interop with K/N and C would allow me and my team to be closer to our native developers and combine effort with them.
6
o

olonho

01/12/2018, 12:48 PM
Thanks Andrey, it makes perfect sense, although we have to keep balance with other directions of work, we fully understand importance of productization of Kotlin/JVM-> C interop
👍 2