Files
kotlin-fork/native/native.tests/testData/CExport/InterfaceV1/kt36639/main.c
T
Sergey Bogolepov dd25130464 [Native][Tests] Move existing CExport tests under the InterfaceV1 dir
To avoid collisions with the future InterfaceNone tests
2024-02-20 15:23:22 +00:00

29 lines
769 B
C
Vendored

#include "kt36639_api.h"
#define __ kt36639_symbols()->
#define T_(x) kt36639_kref_ ## x
int
main() {
T_(CFoo1) foo1 = __ kotlin.root.CFoo1.CFoo1();
T_(CFoo2) foo2 = __ kotlin.root.CFoo2.CFoo2();
T_(kotlin_Int) intV = __ createNullableInt(42);
T_(kotlin_Any) any;
T_(Foo) foo = { .pinned = foo1.pinned };
any.pinned = foo1.pinned;
__ kotlin.root.CFoo1.callMe(foo1, any);
__ kotlin.root.Foo.extfoo(foo, any);
any.pinned = foo2.pinned;
__ kotlin.root.CFoo1.callMe(foo1, any);
__ kotlin.root.Foo.extfoo(foo, any);
any.pinned = intV.pinned;
__ kotlin.root.CFoo1.callMe(foo1, any);
__ kotlin.root.Foo.extfoo(foo, any);
__ DisposeStablePointer(foo1.pinned);
__ DisposeStablePointer(foo2.pinned);
__ DisposeStablePointer(intV.pinned);
}