Hey! I was playing with the Kotlin/Native to creat...
# kotlin-native
p
Hey! I was playing with the Kotlin/Native to create a CLI app for MacOs and along the way I encountered this issue (CoreLocation package definition missing): https://github.com/JetBrains/kotlin-native/issues/3041 As it was suggested in the issue I’m now defining the cinterop in my
build.gradle.kts
-file as follows:
Copy code
macosX64 {
        val lunchfinderMain by compilations.creating {
            val coreLocation by cinterops.creating {
                defFile(project.file("CoreLocation.def"))
                packageName("platform.CoreLocation")
            }
        }
    }
The file
CoreLocation.def
is now located in the (default) path
src/nativeInterop/cinterop/CoreLocation.def
When I run the build I get the same error as described in the ticket (the imported
platform.CoreLocation
package not found). Any suggestions on what might be wrong with my Gradle config? Thanks already in advance!
I also tried with different package name, to not to interfere with the original
platform
package, but no difference there.
d
project.file("src/nativeInterop/cinterop/CoreLocation.def")
p
Ah ok, so also the default path has to be explicitly defined and if the file is not found there is no build time errors?
d
If the name doesn't match the file then yes. `CoreLocation`vs
coreLocation
.
I'm not sure about the build time errors.
p
Ahh, now I see. So the
val coreLocation
should have been
val CoreLocation
when the file is named
CoreLocation.def
?
👍🏼 1
I’ll try that, thanks!
Sorry, late reply on this. But I can confirm that it works now!
👍🏽 2