Hello everyone, I used cinterop to generate parts ...
# kotlin-native
w
Hello everyone, I used cinterop to generate parts for iosArm64, iosX64, and iosArm64sim, and they can all access,But cannot be accessed in iosMain, is this expected? the def config
Copy code
listOf(
        iosArm64(),
        iosSimulatorArm64(),
        iosX64()
    ).forEach {
        it.binaries.framework {
            baseName = "CompressUtil"
            xcf.add(this)
            isStatic = true
        }
        val rustTargetName = when(it.targetName){
            "iosX64" -> "x86_64-apple-ios"
            "iosSimulatorArm64" -> "aarch64-apple-ios-sim"
            "iosArm64" -> "aarch64-apple-ios"
            else -> error("Unsupported target $name")
        }
        it.compilations["main"].cinterops {
            val compressUtil by creating {
                header(project.file("src/rustMain/compress-util.h"))
                includeDirs(
                    project.file("src/rustMain/target/$rustTargetName/release"),
                    project.file("src/rustMain")
                )
            }
        }
    }
in iosX64, iosArm64, iosArm64Sim, it works.
in iosMain it not.
I fix this by adding this to gradle.properties
Copy code
kotlin.mpp.enableCInteropCommonization=true
1