https://kotlinlang.org logo
Title
a

altavir

01/18/2018, 4:19 PM
I currently have some problems with using kotlin native with gradle in IDEA. What I am trying to do is to create a bridge between different languages using C API. I have this API in separate module. In kotlin-native module I have a
def
file in
src/main/c_interop
and expect to place kotlin files in
src/main/kotlin
. Now, I have a few problems. 1)
def
file does not accept relative header names. I have to declare absolute ones, which is not convenient. I remember seeing something about it in issues. Are there any fixes? 2)
src/main/kotlin
is not marked as a source tree. I can mark it myself in idea module options, but it resets itself after gradle sync. 3) generated interop headers are placed in build directory. I can't understand how to access them without creating a copy in the source tree. 4) IDE does not seem to recognize
konan
and
kotlinx.cinterop
packages. How can I load those. Can I do it at all?
o

olonho

01/19/2018, 7:27 AM
2-4) Idea is not supported for developing K/N apps yet
i

ilya.matveev

01/19/2018, 10:28 AM
Kotlin/Native has a preview support in CLion (including code completion/navigation for interop libraries) so you may use it. Here are some details: https://blog.jetbrains.com/kotlin/2017/11/kotlinnative-ide-support-preview/ Note that CLion uses CMake as a build system. You may translate your Gradle project into a CMake one by running
generateCMake
gradle task. Please try using CLion and give us feedback on it.