Permalink
Browse files

get example live

  • Loading branch information...
jonnyzzz committed Jan 14, 2019
1 parent f42811f commit 2a3b1d09e1d38205278b83058c31b42fdc770004
Showing with 13 additions and 3 deletions.
  1. +2 −2 gradle-mpp-groovy/src/native/file.def
  2. +11 −1 gradle-mpp-groovy/src/native/main.kt
@@ -1,6 +1,6 @@
---

void foo(int* x) {
*x = *x + 1;
int foo(int* x) {
return *x = *x + 10;
}

@@ -1,11 +1,21 @@
import file.foo
import kotlinx.cinterop.IntVar
import kotlinx.cinterop.alloc
import kotlinx.cinterop.memScoped
import kotlinx.cinterop.ptr
import kotlinx.cinterop.value

fun main(args: Array<String>) {
println("Hello!")

memScoped {
foo(null)
val q = alloc<IntVar>()
q.value = 123

val z = foo(q.ptr)

println(z)
println(q.value)
}
}

0 comments on commit 2a3b1d0

Please sign in to comment.