How bad of an idea is it to pass variable-capturin...
# kotlin-native
s
How bad of an idea is it to pass variable-capturing lambdas as StableRefs to C callbacks? i.e. pass my callback function as the data pointer, and make the static C function unwrap and call it. Example in thread.
d
Haha, fairly certain this was why StableRef was introduced. I do this all the time.
As long as you're not calling the callback in another thread, there's nothing to worry about.
c
Are you doing another GTK library for kotlin?
s
Nope, I'm drawing inspiration from yours to improve my direct C bindings! I didn't really feel like pulling in an entire lib, and yours is still experimental, but it's solved some problems that I was struggling with initially.