是否可以用C语言编写核心逻辑来为浏览器、android和iphone进行开发?

发布于 2024-12-07 00:53:15 字数 161 浏览 1 评论 0 原文

通过谷歌搜索,这似乎可以在使用 NDK 的 iOS、Android 以及使用 Java Web Start 或 Java Applet 的浏览器中实现。我知道 iOS 和 Android 的 GUI 必须使用 Objective-C 和 Java 来完成。如果这可能的话,当您开始考虑调试支持时,它有多实用?

With some Googling it appears this is possible in iOS, Android using the NDK, and in a browser using Java Web Start or a Java Applet. I understand the GUI for iOS and Android will have to be done using Objective-C and Java. If this is even possible how practical is it when you start to consider debugging support?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小嗷兮 2024-12-14 00:53:15

Objective-C 运行时可以通过 访问C api,因此可以使用纯C++为iOS和Cocoa编写代码。

对于 Web 开发,据我所知,目前没有任何东西可以让您部署用 C++ 编写的代码。这是因为 C++ 通常被编译为本机代码,这很难沙箱化,并且意味着存在安全漏洞。将来,可能可以使用 Native Client 运行此类代码。目前它仍在开发中,但作为 Chromium 的实验性扩展,它已经部分发挥作用。

对于 Android,您的代码必须始终在 Dalvik JVM 中运行,但您可以使用 Android NDK

The Objective-C runtime can be accessed through a C api, so it is possible to write code for iOS and Cocoa using pure C++.

For web development, there is nothing that I know of that is currently available that allows you to deploy code written in C++. This is because C++ is usually compiled into native code, which is very difficult to sandbox and which would imply a security hole. In the future, it may be possible to run such code with Native Client. At the moment it is still in development, but it is already partially functional as an experimental extension to Chromium.

For Android, your code must always run in the Dalvik JVM, but you can incorporate C++ that has been compiled into native code by using the Android NDK.

别把无礼当个性 2024-12-14 00:53:15

I can't speak for the browser, but I've been doing C++ on iOS for almost a couple years now. Both Fieldrunners and Autodesk Tinkerbox (both of which I work on) are C++. The GUI is also custom C++. There is only a tiny amount of Objective-C so that the C++ code can interface with iOS. The Android version of Fieldrunners also uses the C++ codebase with just a tiny amount of Java, again as glue code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文