CInteropSettings
C interoperability settings
This interface represents the configuration settings for invoking the cinterop tool in Kotlin/Native projects. The cinterop tool provides the ability to use C libraries inside Kotlin projects.
Important: Use the CInteropSettings API instead of directly accessing tasks, configurations, and other related domain objects through the Gradle API.
Example
Here is an example of how to use CInteropSettings to configure a cinterop task for the linuxX64
target:
//build.gradle.kts
kotlin {
linuxX64() {
compilations.getByName("main") {
cinterops {
val cinteropForLinuxX64 by creating {
// Configure the CInteropSettings here
}
}
}
}
}
In this example, we've added a cinterop
setting named cinteropForLinuxX64
to the linuxX64
main
KotlinCompilation. These settings are used to create and configure a cinterop
task, along with the necessary dependencies for the compile task.
Types
A collection of directories to look for headers.
Properties
Functions
The options that are passed to the compiler by the cinterop tool.
Adds header files to produce Kotlin bindings. It's equivalent to the -header
cinterop tool option.
A collection of directories to search for headers.
Adds additional linker options. It's equivalent to the -linker-options
cinterop tool option.
Defines the package name for the generated bindings. It is equivalent to passing -pkg
to the cinterop tool.