gpt4 book ai didi

object - Java JNI如何与Kotlin/Native交互以查找对象值?

转载 作者:行者123 更新时间:2023-12-02 13:14:20 27 4
gpt4 key购买 nike

从JetBrains网站:

Kotlin/Native is a technology for compiling Kotlin to native binaries that run without any VM.



但是据我所知,如果使用JNI的C / C++程序要访问java字段,那么Kotlin如何与JNI交互,它必须使用 GetFieldID函数,但是C程序需要来自JVM的信息来描述对象及其值。

如果Kotlin制作不依赖于VM的程序,那么kotlin / Native如何解析字段的值?如何获取Java字段的值?

最佳答案

什么是Kotlin原生

Kotlin / Native与JNI的功能不同,该网站这样描述Kotlin / Native ...

Kotlin/Native is a technology for compiling Kotlin to native binaries that run without any VM. It comprises a LLVM-based backend for the Kotlin compiler and a native implementation of the Kotlin runtime library. Kotlin/Native is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS, embedded targets), or where a developer needs to produce a reasonably-sized self-contained program that does not require an additional runtime. [Source]



JNI允许Java代码与本地代码对话,而Kotlin / Native允许您将Kotlin代码编译为无需运行JVM的本地可执行文件。

关于object - Java JNI如何与Kotlin/Native交互以查找对象值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48423468/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com