staticCFunction

Returns a pointer to C function which calls given Kotlin static function.

external fun <R> staticCFunction(function: () -> R): CPointer<CFunction<() -> R>>(source)
import kotlinx.cinterop.*

// C function that will call the callback we pass in.
// In a real project this would be generated by cinterop from a C header.
external fun invokeCallback(cb: CPointer<CFunction<() -> Unit>>)

fun main() {
    // Convert a Kotlin lambda to a C function pointer.
    val kotlinCallback: CPointer<CFunction<() -> Unit>> = staticCFunction {
        println("Hello from the Kotlin static function!")
    }

    // Pass the function pointer to the C code.
    invokeCallback(kotlinCallback)
}

Source