Files
kotlin-fork/kotlin-native/backend.native/tests/interop/cpp/skiaSignature.kt
T
Vsevolod Tolstopyatov f4e8ae5191 Explicitly declare stability levels of declarations in kotlinx.cinterop package
* @ExperimentalForeignApi for all declarations that operate on
    unmanaged memory (i.e. pointers and references)
* @BetaInteropApi for the rest of the interoperability declarations,
    namely Swift/CInterop-specific interfaces and convenience-functions

### Implementation details

* Some typealiases are not marked explicitly because it crashes the compiler,
    yet their experimentality is properly propagated
* License header is adjusted where it previously had been existing
* Deprecated with ERROR interop declarations that are deprecated for more than
    two years are removed
* WASM target interop declarations are deprecated
* Deliberately make Boolean.toByte and Byte.toBoolean foreign-experimental to scare
    people away

^KT-57728 fixed

Merge-request: KT-MR-9788
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-05-04 13:52:21 +00:00

30 lines
754 B
Kotlin

@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
@file:Suppress("OPT_IN_USAGE_ERROR")
import kotlinx.cinterop.*
import kotlin.test.*
import kotlin.native.internal.*
import org.jetbrains.skiko.skia.native.*
import platform.posix.printf
fun main() {
val a = Data()
a.setData(17)
val b = Data(19)
val c = Data(a)
val d = Data(a, b)
val e = Data(200).foo(a, b)!!
val a1 = a.checkData(17) != 0
val b1 = b.checkData(119) != 0
val c1 = c.checkData(217) != 0
val d1 = d.checkData(436) != 0
val e1 = e.checkData(536) != 0
// Use printf instead of println to avoid messages
// appearing out of order with the native code.
// The native code uses printf.
printf("$a1 $b1 $c1 $d1 $e1\n")
}