Anyone here familiar with JNI/NDK? In Kotlin I ha...
# android
d
Anyone here familiar with JNI/NDK? In Kotlin I have the following:
Copy code
object MyObj {
    val MYBOOL: Boolean by lazy { false }
}
I'm trying to get the value of
MYBOOL
from my C++ code, but I'm unsure of the correct syntax/signature Were this a simple Java Object or static class field, I'd know what to do but with
object
and
lazy
I don't have a good sense of what their native side representation looks like. If anyone can shed some light I'd be thankful!
Also - I guess this isn't strictly Android specific. Is there a better channel for this type of question?
m
#getting-started is probably the best place. Properties in Kotlin cause a
getMYBOOL() -> Boolean
function to be created and you can access that function from JNI like you would any other function. You'll have to first get access to the instance of MyObj (I think it has a static`getInstance` function. Going through the decompiler will show you how it gets converted to byte code and what it would have looked like in Java.
👆 2
🙏 1