f4e8ae5191
* @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>
35 lines
672 B
Kotlin
35 lines
672 B
Kotlin
/*
|
|
* Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
|
* that can be found in the LICENSE file.
|
|
*/
|
|
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
|
|
|
import kotlinx.cinterop.*
|
|
import cglobals.*
|
|
|
|
fun main(args: Array<String>) {
|
|
assert(g1__ == 42)
|
|
|
|
assert(g2 == 17)
|
|
g2 = 42
|
|
assert(g2 == 42)
|
|
|
|
assert(g3.x == 128)
|
|
g3.x = 7
|
|
assert(g3.x == 7)
|
|
|
|
assert(g4[1] == 14)
|
|
g4[1] = 15
|
|
assert(g4[1] == 15)
|
|
|
|
assert(g5[0] == 15)
|
|
assert(g5[3] == 18)
|
|
g5[0] = 16
|
|
assert(g5[0] == 16)
|
|
|
|
assert(g6 == g3.ptr)
|
|
|
|
assert(g8.toLong() == 0x1L)
|
|
assert(g9.toLong() == 0x2L)
|
|
}
|