I strongly advise you to use Gradle + Kotlin MPP plugin. Not only it will provide cinterop
support, but it will ease further development, testing, and multiplatform support. It works on any OS, of course.
If you need an example, here is the official one for the cURL library: https://github.com/JetBrains/kotlin-native/blob/master/samples/libcurl/build.gradle.kts. Note the cinterops
block under compilations["main"]
.
The nice thing about Kotlin MPP plugin is that it actually allows you to play with the Kotlin/Native tools directly. It will download the tools specifically for your platform automatically on the first run and place them in ~/.konan
directory. So if you really want to use cinterop
tool from CLI you'll be able to find it there: ~/.konan/kotlin-native-macos-1.3.61/bin/cinterop
. klib
and kotlinc
are there as well.