Printing a Kotlin/Native object that is exported t...
# kotlin-native
s
Printing a Kotlin/Native object that is exported to an Objective C framework in Swift yields the object name and address, but printing the address of it the Swift way is always that address offset by 0x28. Any idea why this is?
Copy code
let a: MyType = ...
print(a) // MyType@c56528
print(Unmanaged.passUnretained(a).toOpaque()) // 0x0000000100c56500
The second print should print the address of
a
, whereas the first would just be the default toString for Kotlin objects, I don’t know why the addresses are slightly offset though.
o
Because Swift and K/N objects has different layout, so they cannot share same address.
s
So there is two copies of the same object?
I figured the K/N object just gets converted to one Obj C object
o
No, data is shared, but metadata is per-runtime
s
so it is metadata not a duplicate object