Search code examples
kotlinkotlin-multiplatformkotlin-nativekotlin-multiplatform-mobile

Kotlin/Native: How to instantiate an IntVar?


The IntVar constructor takes a NativePtr as an argument.

How do I create an IntVar from Int?


Solution

  • You could try this:

    memScoped {
      val intVar = alloc<IntVar>()
      intVar.value = 123
    }
    

    Check out value for more information