Implement varargs in interop for Kotlin N (#393)

* Implement CValues.equals and .hashCode

* Add trivial test for interop varargs

* Implement varargs in interop for Kotlin N

* Compile and link runtime with libffi

* Fix few places.
This commit is contained in:
SvyatoslavScherbina
2017-03-27 16:44:24 +03:00
committed by Nikolay Igotti
parent 334d2f0ee6
commit c4abb8f706
15 changed files with 340 additions and 13 deletions
+14
View File
@@ -0,0 +1,14 @@
import cstdio.*
import kotlinx.cinterop.*
fun main(args: Array<String>) {
printf("%s %s %d %d %d %lld %.1f %.1lf\n",
"a", "b".cstr, (-1).toByte(), 2.toShort(), 3, Long.MAX_VALUE, 0.1.toFloat(), 0.2)
memScoped {
val aVar = alloc<CInt32Var>()
val bVar = alloc<CInt32Var>()
val sscanfResult = sscanf("42", "%d%d", aVar.ptr, bVar.ptr)
printf("%d %d\n", sscanfResult, aVar.value)
}
}