Would be very useful for IntelliJ to have the abil...
# intellij
n
Would be very useful for IntelliJ to have the ability to generate C callbacks in a Kotlin Native project. Lets say hypothetically these definitions exist in a Kotlin Native library:
Copy code
// ...
interface ApplicationBase {
    // ...
    fun connectActivateSignal(slot: CPointer<CFunction<(app: CPointer<GApplication>, userData: gpointer) -> Unit>>,
                              userData: gpointer): ULong =
        connectGtkSignal(obj = gAppPtr, signal = "activate", slot = slot, data = userData)
}

class Application(val id: String) : ApplicationBase {
    // ...
}
And a hypothetical Kotlin Native program is developed where a Kotliner starts typing in the following with the carrot positioned in the parenthesis:
Copy code
val app = Application("org.example.sampleapp")
app.connectActivateSignal()
Hypothetically in that situation IntelliJ would have a light bulb appear containing the option to generate a C callback. When the option is selected IntelliJ generates a callback and the Kotliner enters in the function name (eg activateApplication):
Copy code
private fun activateApplication(app: CPointer<GApplication>, userData: gpointer) {
    TODO("Implement this C callback")
}
Next IntellIJ changes
app.connectActivateSignal()
to
connectActivateSignal(staticCFunction(::activateApplication))
and inserts the import for
staticCFunction
.
a
Can you please file a feature request at http://kotl.in/issue? Thanks in advance!
n
Filed a new issue in the tracker: https://youtrack.jetbrains.com/issue/KT-35556
­čÖĆ 1