Support @CName annotation for reverse C interop, similar to @JvmName. (#1237)
This commit is contained in:
@@ -2375,7 +2375,8 @@ task produce_dynamic(type: DynamicKonanTest) {
|
||||
"RO property is 42\n" +
|
||||
"RW property is 239\n" +
|
||||
"enum100 = 100\n" +
|
||||
"object = 42\n"
|
||||
"object = 42\n" +
|
||||
"topLevel = 777 3\n"
|
||||
}
|
||||
|
||||
task buildKonanStdlibTests(type: BuildKonanTest) {
|
||||
|
||||
@@ -12,6 +12,16 @@ open class Base {
|
||||
|
||||
open fun fooParam(arg0: String, arg1: Int) = println("Base.fooParam: $arg0 $arg1")
|
||||
|
||||
@konan.internal.CName(fullName = "", shortName = "strangeName") fun странноеИмя() = 111
|
||||
|
||||
}
|
||||
|
||||
@konan.internal.CName(fullName = "topLevelFunctionFromC", shortName = "topLevelFunctionFromCShort")
|
||||
fun topLevelFunction(x1: Int, x2: Int) = x1 - x2
|
||||
|
||||
@konan.internal.CName("topLevelFunctionVoidFromC")
|
||||
fun topLevelFunctionVoid(x1: Int) {
|
||||
assert(x1 == 42)
|
||||
}
|
||||
|
||||
// Enum.
|
||||
|
||||
@@ -18,7 +18,6 @@ int main(void) {
|
||||
|
||||
const char* string = __ kotlin.root.getString();
|
||||
|
||||
|
||||
__ kotlin.root.hello();
|
||||
__ kotlin.root.Base.foo(base);
|
||||
__ kotlin.root.Base.fooParam(base, "a", 1);
|
||||
@@ -37,6 +36,10 @@ int main(void) {
|
||||
|
||||
printf("object = %d\n", __ kotlin.root.Codeable.asCode(object1));
|
||||
|
||||
topLevelFunctionVoidFromC(42);
|
||||
__ kotlin.root.topLevelFunctionVoid(42);
|
||||
printf("topLevel = %d %d\n", topLevelFunctionFromC(780, 3), __ kotlin.root.topLevelFunctionFromCShort(5, 2));
|
||||
|
||||
__ DisposeString(string);
|
||||
__ DisposeStablePointer(base.pinned);
|
||||
__ DisposeStablePointer(child.pinned);
|
||||
|
||||
Reference in New Issue
Block a user