Big Chungus
01/07/2020, 5:15 PM#define G_CALLBACK(f) ((GCallback) (f))
Kris Wong
01/07/2020, 5:18 PMKris Wong
01/07/2020, 5:18 PMBig Chungus
01/07/2020, 5:18 PM(x,y) -> Unit
Big Chungus
01/07/2020, 5:18 PMKris Wong
01/07/2020, 5:19 PMKris Wong
01/07/2020, 5:19 PMBig Chungus
01/07/2020, 5:19 PM// G_CALLBACK() macro is used to cast the callback function pointer
// to generic void pointer
Big Chungus
01/07/2020, 5:20 PMKris Wong
01/07/2020, 5:20 PMBig Chungus
01/07/2020, 5:20 PMKris Wong
01/07/2020, 5:22 PMBig Chungus
01/07/2020, 5:25 PMKris Wong
01/07/2020, 5:25 PMKris Wong
01/07/2020, 5:25 PMBig Chungus
01/07/2020, 5:25 PMKris Wong
01/07/2020, 5:28 PMvoid* f(void (*a)(int))
Big Chungus
01/07/2020, 5:29 PMBig Chungus
01/07/2020, 5:29 PMKris Wong
01/07/2020, 5:33 PMBig Chungus
01/07/2020, 5:39 PM() -> Unit
to CPointer<CFunction<() -> Unit>>
msink
01/07/2020, 5:39 PMKris Wong
01/07/2020, 5:42 PMmsink
01/07/2020, 5:43 PMKris Wong
01/07/2020, 5:44 PM() -> Unit
as an argument, and see how the K/N compiler handles that in the generated bindingsmsink
01/07/2020, 5:44 PMKris Wong
01/07/2020, 5:46 PMnapperley
01/07/2020, 10:51 PMnapperley
01/07/2020, 10:53 PMnapperley
01/07/2020, 10:55 PMreinterpret
extension function, which comes from the Kotlin Native C Interop library.Big Chungus
01/08/2020, 10:07 AMstaticCfunction
and unchecked casts. Everything's working now.Big Chungus
01/08/2020, 10:08 AMstaticCFunction<(CPointer<GtkWidget>,gpointer) -> Unit>() as GCallback
Big Chungus
01/08/2020, 10:10 AMnapperley
01/08/2020, 8:42 PM(CPointer<GtkWidget>, gpointer) -> Unit>()
into a Type Alias. In many cases the Kotlin compiler can apply type inference to the reinterpret
function.