adev_one
04/12/2017, 6:56 PMsvyatoslav.scherbina
04/12/2017, 7:16 PMmain
function from C by calling Konan_main
C function.
It can be declared as extern "C" int Konan_main(int argc, const char** argv);
For example, see concurrent
sample: https://github.com/JetBrains/kotlin-native/blob/master/samples/concurrent/MessageChannel.cpp#L156
2) You can pass some Kotlin functions as callbacks through C interop. See https://github.com/JetBrains/kotlin-native/blob/master/INTEROP.md#callbacks for more details.
Using callbacks is currently not so trivial as it could be. It is required to declare function type (e.g. using typedef
) in C header and then generate bindings with cinterop
tool.adev_one
04/14/2017, 7:27 PMolonho
04/15/2017, 8:49 AMkonanc
as the final linker, linking with external .a, but entry point could be in those .a, not in Kotlin code, see Tetris example for iphone