jk2018
01/12/2020, 7:24 PMkotlinx.cinterop.staticCFunction
" when called as a callback from C . (Thread/SO link)serebit
01/12/2020, 10:29 PMnapperley
01/12/2020, 10:52 PMCPointer
(in the primary constructor) can be instantiated in the event handler, which is handy when the state/functionality is being passed through to the event handler as a CPointer
. The class instance uses that CPointer
to access the state/functionality.napperley
01/12/2020, 10:54 PMKavan
01/13/2020, 8:36 AMfun example(inputPointer: COpaquePointer?) { println(inputPointer.reinterpret<String>()) } // Globally
//Then pass it like.
anyCMethod(staticCFunction(::example).reinterpret(), "hello".cstr/* input parameter for your function*/)
I explained it in simple way.