defFile

abstract fun defFile(file: Any)

Specifies the path to the .def file that declares bindings for the C libraries. This function serves as a setter for the .def file path and is equivalent to passing -def to the cinterop tool.

Usage example

The example below shows how to set a custom .def file path in a build.gradle.kts file:

 //build.gradle.kts
kotlin {
linuxX64 {
compilations.getByName("main").cinterops.create("customCinterop") {
defFile(project.file("custom.def"))
}
}
}

In the example, the custom.def file located in the project directory is set as the .def file.

Parameters

file

The path to the .def file to be used for C interoperability. Default value: src/nativeInterop/cinterop/{name_of_the_cinterop}.def