[K/N] Use @Escapes for all external funs with escaping arguments
This commit is contained in:
committed by
Space Team
parent
8d81fd6647
commit
4e6451c25e
@@ -6,9 +6,11 @@
|
||||
package kotlinx.cinterop
|
||||
|
||||
import kotlin.native.*
|
||||
import kotlin.native.internal.Escapes
|
||||
import kotlin.native.internal.GCUnsafeCall
|
||||
|
||||
@GCUnsafeCall("Kotlin_Interop_createStablePointer")
|
||||
@Escapes(0b01) // any escapes into stable ref.
|
||||
internal external fun createStablePointer(any: Any): COpaquePointer
|
||||
|
||||
@GCUnsafeCall("Kotlin_Interop_disposeStablePointer")
|
||||
|
||||
@@ -62,6 +62,7 @@ internal fun CPointer<*>.cPointerToString() = "CPointer(raw=$rawValue)"
|
||||
*/
|
||||
@ExperimentalForeignApi
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_STATIC_C_FUNCTION)
|
||||
// function is static, so it's never heap allocated anyway; no need to use @Escapes
|
||||
public external fun <R> staticCFunction(@VolatileLambda function: () -> R): CPointer<CFunction<() -> R>>
|
||||
|
||||
@ExperimentalForeignApi
|
||||
|
||||
Reference in New Issue
Block a user