Is there a way to create an object of a Kotlin int...
# kotlin-native
p
Is there a way to create an object of a Kotlin interface in C
Copy code
interface MyInterface {
    fun doSomething()
}

fun useMyInterface(obj: MyInterface) {
    obj.doSomething()
}
Right now the generated C header is something like this
Copy code
typedef struct {
  libtest_KNativePtr pinned;
} libtest_kref_io_example_test_MyInterface;

struct {
  libtest_KType* (*_type)(void);
  void (*doSomething)(libtest_kref_io_example_test_listeners_MyInterface thiz);
} MyInterface;
I can create object of this
MyInterface
struct, but
useMyInterface
will expect a type of
libtest_kref_io_example_test_MyInterface
and to create an object of that pinned would expected to be a pointer to a Kotlin object and not a C pointer to struct of
MyInterface