diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt index a5dc4825526..d2480f99d6d 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt @@ -50,5 +50,5 @@ public typealias SharedImmutable = kotlin.native.concurrent.SharedImmutable */ @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) -public annotation class CName(val externName: String = "", val shortName: String = "") +public actual annotation class CName(actual val externName: String = "", actual val shortName: String = "") diff --git a/libraries/stdlib/src/kotlin/annotations/NativeAnnotations.kt b/libraries/stdlib/src/kotlin/annotations/NativeAnnotations.kt new file mode 100644 index 00000000000..3781a046699 --- /dev/null +++ b/libraries/stdlib/src/kotlin/annotations/NativeAnnotations.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package kotlin.native + +/** + * Makes top level function available from C/C++ code with the given name. + * + * [externName] controls the name of top level function, [shortName] controls the short name. + * If [externName] is empty, no top level declaration is being created. + */ +@SinceKotlin("1.5") +@Target(AnnotationTarget.FUNCTION) +@Retention(AnnotationRetention.BINARY) +@OptionalExpectation +public expect annotation class CName(val externName: String = "", val shortName: String = "")