Anyway to have cinterop change the name of a funct...
# kotlin-native
d
Anyway to have cinterop change the name of a function when building? I'm bringing in OCHamcrest and cinterop fails with
Copy code
common/build/classes/kotlin/ios/main/common-cinterop-ochamcrest.klib-build/kotlin/org/ochamcrest/ochamcrest.kt:127:5: error: expecting function name or receiver type
fun is(value: Any?): Any {
    ^
The problem is the name of the function is a Kotlin keyword,
is
. I verified that manually changing the name in the objc header allowed cinterop to build.
i
AFAIK there is no special option to rename a declaration (@svyatoslav.scherbina correct me if it is not the case) but it seems that you can workaround this issue in the following way: 1. Exclude this function in a def-file (see https://github.com/JetBrains/kotlin-native/blob/master/INTEROP.md#definition-file-hints). 2. Manually add a wrapper for this function in the def-file: https://github.com/JetBrains/kotlin-native/blob/master/INTEROP.md#adding-custom-declarations
l
Maybe cinterop can add backquote to solve this problem.
s
It usually does.
d
K thanks. @ilya.matveev excluding that function worked for my use case.
👍 1
s
Fix for this issue has been added to master branch, and is likely to be added to the next release.
👍 1